Class: GroongaDelta::LocalDelta
- Inherits:
-
Object
- Object
- GroongaDelta::LocalDelta
- Defined in:
- lib/groonga-delta/local-delta.rb
Defined Under Namespace
Modules: ApplyLoggable Classes: CommandProcessor, PackedSchemaTarget, PackedTableTarget, SchemaTarget, TableTarget
Instance Method Summary collapse
- #apply ⇒ Object
-
#initialize(config, status) ⇒ LocalDelta
constructor
A new instance of LocalDelta.
Constructor Details
#initialize(config, status) ⇒ LocalDelta
Returns a new instance of LocalDelta.
25 26 27 28 29 30 |
# File 'lib/groonga-delta/local-delta.rb', line 25 def initialize(config, status) @config = config @status = status @logger = @config.logger @delta_dir = @config.local.delta_dir end |
Instance Method Details
#apply ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/groonga-delta/local-delta.rb', line 32 def apply start_time = read_current_status current_time = Time.now.utc targets = list_targets(@delta_dir, start_time, current_time) = { url: @config.groonga.url, read_timeout: @config.groonga.read_timeout, backend: :synchronous, } Groonga::Client.open() do |client| processor = CommandProcessor.new(@config, client, target_commands: [], target_tables: [], target_columns: []) targets.sort_by(&:timestamp).each do |target| target.apply(@logger, client, processor) @status.update("start_time" => [ target..to_i, target..nsec, ]) end end end |