Class: Wurk::IterableJobQuery
- Inherits:
-
Object
- Object
- Wurk::IterableJobQuery
- Includes:
- Enumerable
- Defined in:
- lib/wurk/iterable_job_query.rb
Overview
Read-side data API for IterableJob progress. Bulk-reads the ‘it-<jid>` HASHes (sidekiq-free.md §1.5) in a single pipeline so dashboards and tools can introspect many iterable jobs without N round trips. The runtime that writes those HASHes lives in Wurk::IterableJob; this is the reader.
Aliased Sidekiq::IterableJobQuery.
Spec: docs/target/sidekiq-free.md §19.9.
Defined Under Namespace
Classes: State
Instance Method Summary collapse
-
#[](jid) ⇒ State?
State for jid, or nil when no ‘it-<jid>` HASH exists (e.g. a non-iterable job, or one whose state has expired).
-
#each ⇒ Object
Yields each present State, in the order its jid was supplied.
-
#initialize(jids) ⇒ IterableJobQuery
constructor
A new instance of IterableJobQuery.
Constructor Details
#initialize(jids) ⇒ IterableJobQuery
Returns a new instance of IterableJobQuery.
32 33 34 |
# File 'lib/wurk/iterable_job_query.rb', line 32 def initialize(jids) @states = fetch(Array(jids)) end |
Instance Method Details
#[](jid) ⇒ State?
Returns state for jid, or nil when no ‘it-<jid>` HASH exists (e.g. a non-iterable job, or one whose state has expired).
38 |
# File 'lib/wurk/iterable_job_query.rb', line 38 def [](jid) = @states[jid] |
#each ⇒ Object
Yields each present State, in the order its jid was supplied. Jids with no state are skipped — only iterable jobs with live state appear.
42 |
# File 'lib/wurk/iterable_job_query.rb', line 42 def each(&) = @states.each_value(&) |