Class: GroongaDelta::LocalVacuumer

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

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ LocalVacuumer

Returns a new instance of LocalVacuumer.



22
23
24
25
26
# File 'lib/groonga-delta/local-vacuumer.rb', line 22

def initialize(config)
  @logger = config.logger
  @delta_dir = config.delta_dir
  @config = config.vacuum
end

Instance Method Details

#vacuumObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/groonga-delta/local-vacuumer.rb', line 28

def vacuum
  keep_span = @config.keep_span
  return if keep_span.nil?
  return if keep_span < 0
  reader = LocalReader.new(@logger, @delta_dir)
  max_timestamp = Time.now.utc - keep_span
  reader.each(nil, max_timestamp) do |target|
    target.vacuum(@logger)
  end
end