Class: Textus::Background::Job::Sweep

Inherits:
Base
  • Object
show all
Defined in:
lib/textus/background/job/sweep.rb

Constant Summary collapse

REQUIRED_ROLE =
Textus::Role::AUTOMATION
TYPE =
"sweep"

Instance Method Summary collapse

Methods inherited from Base

inherited

Constructor Details

#initialize(scope: nil, key: nil) ⇒ Sweep

Returns a new instance of Sweep.



10
11
12
13
14
# File 'lib/textus/background/job/sweep.rb', line 10

def initialize(scope: nil, key: nil)
  super()
  @scope = scope || {}
  @key   = key
end

Instance Method Details

#argsObject



16
# File 'lib/textus/background/job/sweep.rb', line 16

def args = { scope: @scope, key: @key }.compact

#call(container:, call:) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/textus/background/job/sweep.rb', line 18

def call(container:, call:)
  prefix = @key || (@scope.is_a?(Hash) ? @scope["prefix"] : nil)
  lane   = @scope.is_a?(Hash) ? @scope["lane"] : nil
  rows = Textus::Core::Retention::Sweep.new(
    manifest: container.manifest,
    file_stat: Textus::Ports::Storage::FileStat.new,
    clock: Textus::Ports::Clock.new,
  ).call(prefix: prefix, lane: lane)
  Textus::Background::Retention::Apply.new(container: container, call: call).call(rows)
end