Class: Gizzard::Transformation::Op::SetForwarding

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

Instance Attribute Summary

Attributes inherited from ShardOp

#template

Instance Method Summary collapse

Methods inherited from ShardOp

#eql?, #initialize, #inverse?

Methods inherited from BaseOp

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

Constructor Details

This class inherits a constructor from Gizzard::Transformation::Op::ShardOp

Instance Method Details

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



202
203
204
205
206
# File 'lib/gizzard/transformation_op.rb', line 202

def apply(nameserver, table_id, base_id, table_prefix, translations)
  shard_id   = template.to_shard_id(table_prefix, translations)
  forwarding = Forwarding.new(table_id, base_id, shard_id)
  nameserver.set_forwarding(forwarding)
end

#expand(copy_source, involved_in_copy) ⇒ Object



192
193
194
195
196
197
198
199
200
# File 'lib/gizzard/transformation_op.rb', line 192

def expand(copy_source, involved_in_copy)
  if involved_in_copy && @wrapper_type
    wrapper = ShardTemplate.new(@wrapper_type, nil, 0, '', '', [to])
    { :prepare => [SetForwarding.new(template, wrapper)],
      :cleanup => [self] }
  else
    { :prepare => [self] }
  end
end