Class: LucidWorks::Cluster::Shard
- Inherits:
-
Object
- Object
- LucidWorks::Cluster::Shard
- Includes:
- ActiveModel::Serializers::JSON
- Defined in:
- lib/lucid_works/cluster.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#leader ⇒ Object
(also: #leader?)
readonly
Returns the value of attribute leader.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #as_json(options = {}) ⇒ Object
-
#initialize(node, name, collection, leader) ⇒ Shard
constructor
A new instance of Shard.
Constructor Details
#initialize(node, name, collection, leader) ⇒ Shard
Returns a new instance of Shard.
33 34 35 36 37 38 39 |
# File 'lib/lucid_works/cluster.rb', line 33 def initialize(node, name, collection, leader) @id = "#{collection}_#{name}" @node = node @name = name @collection = collection @leader = leader end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
30 31 32 |
# File 'lib/lucid_works/cluster.rb', line 30 def collection @collection end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
30 31 32 |
# File 'lib/lucid_works/cluster.rb', line 30 def id @id end |
#leader ⇒ Object (readonly) Also known as: leader?
Returns the value of attribute leader.
30 31 32 |
# File 'lib/lucid_works/cluster.rb', line 30 def leader @leader end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
30 31 32 |
# File 'lib/lucid_works/cluster.rb', line 30 def name @name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
30 31 32 |
# File 'lib/lucid_works/cluster.rb', line 30 def node @node end |
Instance Method Details
#==(other) ⇒ Object
45 46 47 |
# File 'lib/lucid_works/cluster.rb', line 45 def ==(other) node == other.node && name == other.name && collection == other.collection end |
#as_json(options = {}) ⇒ Object
41 42 43 |
# File 'lib/lucid_works/cluster.rb', line 41 def as_json( = {}) {'name' => name, 'collection' => collection, 'leader' => leader} end |