Class: Gizzard::Transformation::Op::CopyShard
- Defined in:
- lib/gizzard/transformation_op.rb
Constant Summary collapse
- BUSY =
1
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#shards ⇒ Object
(also: #template)
readonly
Returns the value of attribute shards.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #apply(nameserver, table_id, base_id, table_prefix, translations) ⇒ Object
- #expand(*args) ⇒ Object
-
#initialize(*shards) ⇒ CopyShard
constructor
A new instance of CopyShard.
- #involved_shards(table_prefix, translations) ⇒ Object
Methods inherited from BaseOp
#<=>, #eql?, #inspect, #inverse?
Constructor Details
#initialize(*shards) ⇒ CopyShard
Returns a new instance of CopyShard.
35 36 37 |
# File 'lib/gizzard/transformation_op.rb', line 35 def initialize(*shards) @shards = shards end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
32 33 34 |
# File 'lib/gizzard/transformation_op.rb', line 32 def from @from end |
#shards ⇒ Object (readonly) Also known as: template
Returns the value of attribute shards.
32 33 34 |
# File 'lib/gizzard/transformation_op.rb', line 32 def shards @shards end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
32 33 34 |
# File 'lib/gizzard/transformation_op.rb', line 32 def to @to end |
Instance Method Details
#apply(nameserver, table_id, base_id, table_prefix, translations) ⇒ Object
45 46 47 48 |
# File 'lib/gizzard/transformation_op.rb', line 45 def apply(nameserver, table_id, base_id, table_prefix, translations) involved_shards(table_prefix, translations).each { |sid| nameserver.mark_shard_busy(sid, BUSY) } nameserver.copy_shard(involved_shards(table_prefix, translations)) end |
#expand(*args) ⇒ Object
39 |
# File 'lib/gizzard/transformation_op.rb', line 39 def (*args); { :copy => [self] } end |
#involved_shards(table_prefix, translations) ⇒ Object
41 42 43 |
# File 'lib/gizzard/transformation_op.rb', line 41 def involved_shards(table_prefix, translations) shards.map{|s| s.to_shard_id(table_prefix, translations)} end |