Class: Rails::Sharding::ShardThreadRegistry
- Inherits:
-
Object
- Object
- Rails::Sharding::ShardThreadRegistry
- Extended by:
- ActiveSupport::PerThreadRegistry
- Defined in:
- lib/rails/sharding/shard_thread_registry.rb
Instance Attribute Summary collapse
-
#_current_shard_group ⇒ Object
Returns the value of attribute _current_shard_group.
-
#_current_shard_name ⇒ Object
Returns the value of attribute _current_shard_name.
Class Method Summary collapse
- .connect_back_to_master! ⇒ Object
- .connecting_to_master? ⇒ Boolean
- .connecting_to_shard? ⇒ Boolean
-
.current_shard_group ⇒ Object
Returns the current shard group (for the current Thread).
-
.current_shard_group=(group) ⇒ Object
Sets the current shard group (for the current Thread).
- .current_shard_group_and_name ⇒ Object
-
.current_shard_name ⇒ Object
Returns the current shard name (for the current Thread).
-
.current_shard_name=(name) ⇒ Object
Sets the current shard name (for the current Thread).
Instance Attribute Details
#_current_shard_group ⇒ Object
Returns the value of attribute _current_shard_group.
7 8 9 |
# File 'lib/rails/sharding/shard_thread_registry.rb', line 7 def _current_shard_group @_current_shard_group end |
#_current_shard_name ⇒ Object
Returns the value of attribute _current_shard_name.
8 9 10 |
# File 'lib/rails/sharding/shard_thread_registry.rb', line 8 def _current_shard_name @_current_shard_name end |
Class Method Details
.connect_back_to_master! ⇒ Object
18 19 20 21 |
# File 'lib/rails/sharding/shard_thread_registry.rb', line 18 def self.connect_back_to_master! self.current_shard_group = nil self.current_shard_name = nil end |
.connecting_to_master? ⇒ Boolean
10 11 12 |
# File 'lib/rails/sharding/shard_thread_registry.rb', line 10 def self.connecting_to_master? current_shard_group.nil? || current_shard_name.nil? end |
.connecting_to_shard? ⇒ Boolean
14 15 16 |
# File 'lib/rails/sharding/shard_thread_registry.rb', line 14 def self.connecting_to_shard? !connecting_to_master? end |
.current_shard_group ⇒ Object
Returns the current shard group (for the current Thread)
24 25 26 |
# File 'lib/rails/sharding/shard_thread_registry.rb', line 24 def self.current_shard_group _current_shard_group end |
.current_shard_group=(group) ⇒ Object
Sets the current shard group (for the current Thread)
29 30 31 |
# File 'lib/rails/sharding/shard_thread_registry.rb', line 29 def self.current_shard_group=(group) self._current_shard_group = group.blank? ? nil : group.to_sym end |
.current_shard_group_and_name ⇒ Object
43 44 45 |
# File 'lib/rails/sharding/shard_thread_registry.rb', line 43 def self.current_shard_group_and_name [current_shard_group, current_shard_name] end |
.current_shard_name ⇒ Object
Returns the current shard name (for the current Thread)
34 35 36 |
# File 'lib/rails/sharding/shard_thread_registry.rb', line 34 def self.current_shard_name _current_shard_name end |
.current_shard_name=(name) ⇒ Object
Sets the current shard name (for the current Thread)
39 40 41 |
# File 'lib/rails/sharding/shard_thread_registry.rb', line 39 def self.current_shard_name=(name) self._current_shard_name = name.blank? ? nil : name.to_sym end |