Class: Textus::Jobs::Seeder
- Inherits:
-
Object
- Object
- Textus::Jobs::Seeder
- Defined in:
- lib/textus/jobs/seeder.rb
Overview
Enqueues the full convergence set for a scope: a produce job per derived / publish_tree / publish.to entry, a re-pull job per stale intake key, and a single sweep job for the scope. The scope logic mirrors the converge scope (Produce::Engine) so ‘drain` and `serve` converge identically. Produce jobs self-elevate (stamped automation); the sweep job carries the caller’s role (destructive runs as caller).
Instance Method Summary collapse
-
#initialize(container:, queue:, call:) ⇒ Seeder
constructor
A new instance of Seeder.
- #seed(prefix:, zone:) ⇒ Object
Constructor Details
#initialize(container:, queue:, call:) ⇒ Seeder
Returns a new instance of Seeder.
10 11 12 13 14 15 |
# File 'lib/textus/jobs/seeder.rb', line 10 def initialize(container:, queue:, call:) @container = container @queue = queue @call = call @manifest = container.manifest end |
Instance Method Details
#seed(prefix:, zone:) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/textus/jobs/seeder.rb', line 17 def seed(prefix:, zone:) file_stat = Textus::Ports::Storage::FileStat.new producible_keys(prefix, zone).each do |key| @queue.enqueue(job("materialize", { "key" => key }, Textus::Role::AUTOMATION)) end stale_intake_keys(prefix, zone, file_stat).each do |key| @queue.enqueue(job("re-pull", { "key" => key }, Textus::Role::AUTOMATION)) end @queue.enqueue(job("sweep", { "scope" => { "prefix" => prefix, "zone" => zone } }, @call.role)) end |