Class: Gizzard::Transformation::Op::DiffShards

Inherits:
BaseOp
  • Object
show all
Defined in:
lib/gizzard/transformation_op.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseOp

#<=>, #eql?, #inspect, #inverse?

Constructor Details

#initialize(from, to) ⇒ DiffShards

Returns a new instance of DiffShards.



74
75
76
77
# File 'lib/gizzard/transformation_op.rb', line 74

def initialize(from, to)
  @from = from
  @to   = to
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



71
72
73
# File 'lib/gizzard/transformation_op.rb', line 71

def from
  @from
end

#toObject (readonly) Also known as: template

Returns the value of attribute to.



71
72
73
# File 'lib/gizzard/transformation_op.rb', line 71

def to
  @to
end

Instance Method Details

#apply(nameserver, table_id, base_id, table_prefix, translations) ⇒ Object



85
86
87
88
89
90
# File 'lib/gizzard/transformation_op.rb', line 85

def apply(nameserver, table_id, base_id, table_prefix, translations)
  from_shard_id = from.to_shard_id(table_prefix, translations)
  to_shard_id   = to.to_shard_id(table_prefix, translations)

  nameserver.diff_shards(from_shard_id, to_shard_id)
end

#expand(*args) ⇒ Object



79
# File 'lib/gizzard/transformation_op.rb', line 79

def expand(*args); { :repair => [self] } end

#involved_shards(table_prefix, translations) ⇒ Object



81
82
83
# File 'lib/gizzard/transformation_op.rb', line 81

def involved_shards(table_prefix, translations)
  [to.to_shard_id(table_prefix, translations)]
end