Class: OllamaAgent::Runtime::CompactorRunner
- Inherits:
-
Object
- Object
- OllamaAgent::Runtime::CompactorRunner
- Defined in:
- lib/ollama_agent/runtime/compactor_runner.rb
Overview
Epoch-gated driver for Compactor; safe to call from a daemon loop (not auto-started).
Instance Method Summary collapse
-
#initialize(compactor:, interval_epochs:) ⇒ CompactorRunner
constructor
A new instance of CompactorRunner.
-
#tick(current_epoch:) ⇒ Hash?
Compaction counts when a run fires;
nilwhen below interval.
Constructor Details
#initialize(compactor:, interval_epochs:) ⇒ CompactorRunner
Returns a new instance of CompactorRunner.
7 8 9 10 11 |
# File 'lib/ollama_agent/runtime/compactor_runner.rb', line 7 def initialize(compactor:, interval_epochs:) @compactor = compactor @interval = interval_epochs.to_i @last_compact_epoch = nil end |
Instance Method Details
#tick(current_epoch:) ⇒ Hash?
Returns compaction counts when a run fires; nil when below interval.
14 15 16 17 18 19 20 21 22 |
# File 'lib/ollama_agent/runtime/compactor_runner.rb', line 14 def tick(current_epoch:) epoch = current_epoch.to_i if @last_compact_epoch.nil? || (epoch - @last_compact_epoch) >= @interval @last_compact_epoch = epoch return @compactor.compact(current_epoch: epoch) end nil end |