Class: Textus::Application::Write::RefreshWorker::Impl
- Inherits:
-
Object
- Object
- Textus::Application::Write::RefreshWorker::Impl
- Defined in:
- lib/textus/application/write/refresh_worker.rb
Instance Method Summary collapse
-
#call(key) ⇒ Object
call(key) is the primary entry; run is kept as an alias for Orchestrator and RefreshAll which call worker.run(key).
-
#initialize(ctx:, caps:, rpc:, writer:, hook_context:) ⇒ Impl
constructor
A new instance of Impl.
- #run(key) ⇒ Object
Constructor Details
#initialize(ctx:, caps:, rpc:, writer:, hook_context:) ⇒ Impl
Returns a new instance of Impl.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/textus/application/write/refresh_worker.rb', line 19 def initialize(ctx:, caps:, rpc:, writer:, hook_context:) @ctx = ctx @caps = caps @manifest = caps.manifest @writer = writer @events = caps.events @rpc = rpc @authorizer = caps. @hook_context = hook_context end |
Instance Method Details
#call(key) ⇒ Object
call(key) is the primary entry; run is kept as an alias for Orchestrator and RefreshAll which call worker.run(key).
32 33 34 |
# File 'lib/textus/application/write/refresh_worker.rb', line 32 def call(key) run(key) end |
#run(key) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/textus/application/write/refresh_worker.rb', line 36 def run(key) res = @manifest.resolver.resolve(key) mentry = res.entry path = res.path remaining = res.remaining raise UsageError.new("no intake declared for '#{key}'") unless mentry.is_a?(Textus::Manifest::Entry::Intake) before_etag = File.exist?(path) ? Etag.for_file(path) : nil result = fetch_with_events(key, mentry, remaining) persist_and_notify(key, mentry, result, before_etag) end |