Class: GroongaDelta::LocalReader::TableTarget
- Inherits:
-
Object
- Object
- GroongaDelta::LocalReader::TableTarget
- Includes:
- Loggable
- Defined in:
- lib/groonga-delta/local-reader.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #apply(logger, client, processor) ⇒ Object
-
#initialize(path, timestamp, name, action) ⇒ TableTarget
constructor
A new instance of TableTarget.
- #vacuum(logger) ⇒ Object
Constructor Details
#initialize(path, timestamp, name, action) ⇒ TableTarget
Returns a new instance of TableTarget.
292 293 294 295 296 297 |
# File 'lib/groonga-delta/local-reader.rb', line 292 def initialize(path, , name, action) @path = path @timestamp = @name = name @action = action end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
291 292 293 |
# File 'lib/groonga-delta/local-reader.rb', line 291 def action @action end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
290 291 292 |
# File 'lib/groonga-delta/local-reader.rb', line 290 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
288 289 290 |
# File 'lib/groonga-delta/local-reader.rb', line 288 def path @path end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
289 290 291 |
# File 'lib/groonga-delta/local-reader.rb', line 289 def @timestamp end |
Instance Method Details
#apply(logger, client, processor) ⇒ Object
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/groonga-delta/local-reader.rb', line 299 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 |
#vacuum(logger) ⇒ Object
315 316 317 318 319 |
# File 'lib/groonga-delta/local-reader.rb', line 315 def vacuum(logger) vacuum_log(logger, @path) do FileUtils.rm(@path) end end |