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/sequel_ext.rb,
lib/sequel/schema-sharding/logger_proxy.rb,
lib/sequel/schema-sharding/configuration.rb,
lib/sequel/schema-sharding/database_manager.rb,
lib/sequel/schema-sharding/connection_manager.rb
Defined Under Namespace
Modules: SequelExt, ShardedModel
Classes: Configuration, ConnectionManager, DatabaseManager, Finder, LoggerProxy, Ring
Constant Summary
collapse
- VERSION =
"0.2.0"
Class Method Summary
collapse
Class Method Details
.config=(config) ⇒ Object
18
19
20
|
# File 'lib/sequel/schema-sharding.rb', line 18
def self.config=(config)
@config = config
end
|
.connection_manager ⇒ Object
30
31
32
|
# File 'lib/sequel/schema-sharding.rb', line 30
def self.connection_manager
@connection_manager ||= ConnectionManager.new
end
|
.connection_manager=(connection_manager) ⇒ Object
34
35
36
|
# File 'lib/sequel/schema-sharding.rb', line 34
def self.connection_manager=(connection_manager)
@connection_manager = connection_manager
end
|
.logger ⇒ Object
22
23
24
|
# File 'lib/sequel/schema-sharding.rb', line 22
def self.logger
@logger ||= Logger.new(StringIO.new)
end
|
.logger=(logger) ⇒ Object
26
27
28
|
# File 'lib/sequel/schema-sharding.rb', line 26
def self.logger=(logger)
@logger = logger
end
|
.migration_path ⇒ Object
46
47
48
|
# File 'lib/sequel/schema-sharding.rb', line 46
def self.migration_path
@migration_path || raise('You must set the migration path.')
end
|
.migration_path=(path) ⇒ Object
50
51
52
|
# File 'lib/sequel/schema-sharding.rb', line 50
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
.sharding_yml_path ⇒ Object
38
39
40
|
# File 'lib/sequel/schema-sharding.rb', line 38
def self.sharding_yml_path
@sharding_yml_path ||= File.expand_path('../../../config/sharding.yml', __FILE__)
end
|
.sharding_yml_path=(path) ⇒ Object
42
43
44
|
# File 'lib/sequel/schema-sharding.rb', line 42
def self.sharding_yml_path=(path)
@sharding_yml_path = path
end
|