Module: Sequel::SchemaSharding
- Defined in:
- lib/sequel/schema-sharding.rb,
lib/sequel/schema-sharding/ring.rb,
lib/sequel/schema-sharding/model.rb,
lib/sequel/schema-sharding/finder.rb,
lib/sequel/schema-sharding/version.rb,
lib/sequel/schema-sharding/logger_proxy.rb,
lib/sequel/schema-sharding/configuration.rb,
lib/sequel/schema-sharding/dtrace_provider.rb,
lib/sequel/schema-sharding/database_manager.rb,
lib/sequel/schema-sharding/connection_manager.rb,
lib/sequel/schema-sharding/extensions/migrations_ext.rb,
lib/sequel/schema-sharding/connection_strategies/random.rb,
lib/sequel/schema-sharding/connection_strategies/primary_with_failover.rb
Defined Under Namespace
Modules: ConnectionStrategy, Extensions, ShardedModel
Classes: Configuration, ConnectionManager, DTraceProvider, DatabaseManager, Finder, LoggerProxy, Ring
Constant Summary
collapse
- VERSION =
"0.13.4"
Class Method Summary
collapse
Class Method Details
.config=(config) ⇒ Object
21
22
23
|
# File 'lib/sequel/schema-sharding.rb', line 21
def self.config=(config)
@config = config
end
|
.connection_manager ⇒ Object
41
42
43
|
# File 'lib/sequel/schema-sharding.rb', line 41
def self.connection_manager
@connection_manager ||= ConnectionManager.new
end
|
.connection_manager=(connection_manager) ⇒ Object
45
46
47
|
# File 'lib/sequel/schema-sharding.rb', line 45
def self.connection_manager=(connection_manager)
@connection_manager = connection_manager
end
|
.logger ⇒ Object
33
34
35
|
# File 'lib/sequel/schema-sharding.rb', line 33
def self.logger
@logger ||= Logger.new(nil)
end
|
.logger=(logger) ⇒ Object
37
38
39
|
# File 'lib/sequel/schema-sharding.rb', line 37
def self.logger=(logger)
@logger = logger
end
|
.migration_path ⇒ Object
57
58
59
|
# File 'lib/sequel/schema-sharding.rb', line 57
def self.migration_path
@migration_path || raise('You must set the migration path.')
end
|
.migration_path=(path) ⇒ Object
61
62
63
|
# File 'lib/sequel/schema-sharding.rb', line 61
def self.migration_path=(path)
@migration_path = path
end
|
.Model(source) ⇒ Object
Extensions to the Sequel model to allow logical/physical shards. Actual table models should inherit this class like so:
class Cat < Sequel::SchemaSharding::Model
set_columns [:cat_id, :fur, :tongue, :whiskers] set_sharded_column :cat_id
def self.by_cat_id(id)
shard_for(id).where(cat_id: id)
end
end
.replica_strategy ⇒ Object
.replica_strategy=(strategy) ⇒ Object
29
30
31
|
# File 'lib/sequel/schema-sharding.rb', line 29
def self.replica_strategy=(strategy)
@replica_strategy = strategy
end
|
.sharding_yml_path ⇒ Object
49
50
51
|
# File 'lib/sequel/schema-sharding.rb', line 49
def self.sharding_yml_path
@sharding_yml_path ||= File.expand_path('../../../config/sharding.yml', __FILE__)
end
|
.sharding_yml_path=(path) ⇒ Object
53
54
55
|
# File 'lib/sequel/schema-sharding.rb', line 53
def self.sharding_yml_path=(path)
@sharding_yml_path = path
end
|