Class: ActiveRecord::Turntable::Configuration
- Inherits:
-
Object
- Object
- ActiveRecord::Turntable::Configuration
show all
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/active_record/turntable/configuration.rb,
lib/active_record/turntable/configuration/dsl.rb,
lib/active_record/turntable/configuration/loader.rb,
lib/active_record/turntable/configuration/loader/dsl.rb,
lib/active_record/turntable/configuration/loader/yaml.rb
Defined Under Namespace
Modules: Loader
Classes: DSL
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Configuration.
13
14
15
16
|
# File 'lib/active_record/turntable/configuration.rb', line 13
def initialize
@cluster_registry = ClusterRegistry.new
@sequencer_registry = SequencerRegistry.new
end
|
Instance Attribute Details
#cluster_registry ⇒ Object
Also known as:
clusters
Returns the value of attribute cluster_registry.
7
8
9
|
# File 'lib/active_record/turntable/configuration.rb', line 7
def cluster_registry
@cluster_registry
end
|
#raise_on_not_specified_shard_query ⇒ Object
Returns the value of attribute raise_on_not_specified_shard_query.
8
9
10
|
# File 'lib/active_record/turntable/configuration.rb', line 8
def raise_on_not_specified_shard_query
@raise_on_not_specified_shard_query
end
|
#raise_on_not_specified_shard_update ⇒ Object
Returns the value of attribute raise_on_not_specified_shard_update.
8
9
10
|
# File 'lib/active_record/turntable/configuration.rb', line 8
def raise_on_not_specified_shard_update
@raise_on_not_specified_shard_update
end
|
#sequencer_registry ⇒ Object
Returns the value of attribute sequencer_registry.
7
8
9
|
# File 'lib/active_record/turntable/configuration.rb', line 7
def sequencer_registry
@sequencer_registry
end
|
Class Method Details
35
36
37
|
# File 'lib/active_record/turntable/configuration.rb', line 35
def self.configure(&block)
new.tap { |c| c.configure(&block) }
end
|
.load(path, env) ⇒ Object
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/active_record/turntable/configuration.rb', line 39
def self.load(path, env)
case File.extname(path)
when ".yml"
Loader::YAML.load(path, env)
when ".rb"
Loader::DSL.load(path)
else
raise InvalidConfigurationError, "Invalid configuration file path: #{path}"
end
end
|
Instance Method Details
#cluster(name) ⇒ Object
18
19
20
|
# File 'lib/active_record/turntable/configuration.rb', line 18
def cluster(name)
cluster_registry[name]
end
|
#release! ⇒ Object
30
31
32
33
|
# File 'lib/active_record/turntable/configuration.rb', line 30
def release!
cluster_registry.release!
sequencer_registry.release!
end
|
#sequencer(name) ⇒ Object
26
27
28
|
# File 'lib/active_record/turntable/configuration.rb', line 26
def sequencer(name)
sequencer_registry[name]
end
|
#sequencers ⇒ Object
22
23
24
|
# File 'lib/active_record/turntable/configuration.rb', line 22
def sequencers
sequencer_registry.sequencers
end
|