Class: GroongaDelta::LocalDelta::TableTarget

Inherits:
Object
  • Object
show all
Includes:
ApplyLoggable
Defined in:
lib/groonga-delta/local-delta.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, timestamp, name, action) ⇒ TableTarget

Returns a new instance of TableTarget.



294
295
296
297
298
299
# File 'lib/groonga-delta/local-delta.rb', line 294

def initialize(path, timestamp, name, action)
  @path = path
  @timestamp = timestamp
  @name = name
  @action = action
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



293
294
295
# File 'lib/groonga-delta/local-delta.rb', line 293

def action
  @action
end

#nameObject (readonly)

Returns the value of attribute name.



292
293
294
# File 'lib/groonga-delta/local-delta.rb', line 292

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



290
291
292
# File 'lib/groonga-delta/local-delta.rb', line 290

def path
  @path
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



291
292
293
# File 'lib/groonga-delta/local-delta.rb', line 291

def timestamp
  @timestamp
end

Instance Method Details

#apply(logger, client, processor) ⇒ Object



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/groonga-delta/local-delta.rb', line 301

def apply(logger, client, processor)
  apply_log(logger, @path) do
    if @path.end_with?(".grn")
      processor.load(@path)
    else
      # TODO: Add support for @action == "delete"
      table = Arrow::Table.load(@path)
      command = Groonga::Command::Load.new(table: @name,
                                           values: table,
                                           command_version: "3")
      response = client.load(command.arguments)
      processor.process_response(response, command)
    end
  end
end