Class: Gizzard::MigratorConfig

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ MigratorConfig

Returns a new instance of MigratorConfig.



5
6
7
# File 'lib/gizzard/migrator.rb', line 5

def initialize(opts = {})
  opts.each {|(k,v)| send("#{k}=", v) if respond_to? "{k}=" }
end

Instance Attribute Details

#destination_typeObject

Returns the value of attribute destination_type.



3
4
5
# File 'lib/gizzard/migrator.rb', line 3

def destination_type
  @destination_type
end

#forwarding_spaceObject

Returns the value of attribute forwarding_space.



3
4
5
# File 'lib/gizzard/migrator.rb', line 3

def forwarding_space
  @forwarding_space
end

#forwarding_space_minObject

Returns the value of attribute forwarding_space_min.



3
4
5
# File 'lib/gizzard/migrator.rb', line 3

def forwarding_space_min
  @forwarding_space_min
end

#manifestObject

Returns the value of attribute manifest.



3
4
5
# File 'lib/gizzard/migrator.rb', line 3

def manifest
  @manifest
end

#prefixObject

Returns the value of attribute prefix.



3
4
5
# File 'lib/gizzard/migrator.rb', line 3

def prefix
  @prefix
end

#source_typeObject

Returns the value of attribute source_type.



3
4
5
# File 'lib/gizzard/migrator.rb', line 3

def source_type
  @source_type
end

#table_idObject

Returns the value of attribute table_id.



3
4
5
# File 'lib/gizzard/migrator.rb', line 3

def table_id
  @table_id
end

Instance Method Details

#shard_name(enum) ⇒ Object



9
10
11
12
# File 'lib/gizzard/migrator.rb', line 9

def shard_name(enum)
  table_id_segment = (table_id && table_id < 0) ? "n#{table_id.abs}" : table_id
  [prefix, table_id, "%04d" % enum].compact.join("_")
end