Class: Droonga::Catalog::Generator::Replica

Inherits:
Object
  • Object
show all
Defined in:
lib/droonga/catalog/generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, options = {}) ⇒ Replica

Returns a new instance of Replica.



209
210
211
212
213
214
# File 'lib/droonga/catalog/generator.rb', line 209

def initialize(host, options={})
  @host     = host
  @port     = options[:port]     || DEFAULT_PORT
  @tag      = options[:tag]      || DEFAULT_TAG
  @n_slices = options[:n_slices] || DEFAULT_N_SLICES
end

Instance Method Details

#to_catalogObject



216
217
218
219
220
221
222
223
224
225
226
# File 'lib/droonga/catalog/generator.rb', line 216

def to_catalog
  slices = []
  @n_slices.times do |i|
    slices << catalog_slice(i)
  end
  {
    "dimension" => "_key",
    "slicer" => "hash",
    "slices" => slices,
  }
end