Class: Hatchet::WorkerRuntime::DurableEviction::DurableRunRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/hatchet/worker/durable_eviction/cache.rb

Overview

Per-run state tracked by the cache.

“wait_count“ is ref-counted so concurrent waits over the same durable run don’t prematurely clear the waiting flag when one child completes before the others.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, step_run_id:, invocation_count:, eviction_policy:, registered_at:) ⇒ DurableRunRecord

Returns a new instance of DurableRunRecord.

Parameters:

  • key (String)

    The action key uniquely identifying this step run invocation.

  • step_run_id (String)
  • invocation_count (Integer)
  • eviction_policy (Hatchet::EvictionPolicy, nil)
  • registered_at (Time)


29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/hatchet/worker/durable_eviction/cache.rb', line 29

def initialize(key:, step_run_id:, invocation_count:, eviction_policy:, registered_at:)
  @key = key
  @step_run_id = step_run_id
  @invocation_count = invocation_count
  @eviction_policy = eviction_policy
  @registered_at = registered_at
  @waiting_since = nil
  @wait_kind = nil
  @wait_resource_id = nil
  @eviction_reason = nil
  @wait_count = 0
end

Instance Attribute Details

#eviction_policyObject (readonly)

Returns the value of attribute eviction_policy.



21
22
23
# File 'lib/hatchet/worker/durable_eviction/cache.rb', line 21

def eviction_policy
  @eviction_policy
end

#eviction_reasonObject

Returns the value of attribute eviction_reason.



22
23
24
# File 'lib/hatchet/worker/durable_eviction/cache.rb', line 22

def eviction_reason
  @eviction_reason
end

#invocation_countObject (readonly)

Returns the value of attribute invocation_count.



21
22
23
# File 'lib/hatchet/worker/durable_eviction/cache.rb', line 21

def invocation_count
  @invocation_count
end

#keyObject (readonly)

Returns the value of attribute key.



21
22
23
# File 'lib/hatchet/worker/durable_eviction/cache.rb', line 21

def key
  @key
end

#registered_atObject (readonly)

Returns the value of attribute registered_at.



21
22
23
# File 'lib/hatchet/worker/durable_eviction/cache.rb', line 21

def registered_at
  @registered_at
end

#step_run_idObject (readonly)

Returns the value of attribute step_run_id.



21
22
23
# File 'lib/hatchet/worker/durable_eviction/cache.rb', line 21

def step_run_id
  @step_run_id
end

#wait_countObject

Returns the value of attribute wait_count.



22
23
24
# File 'lib/hatchet/worker/durable_eviction/cache.rb', line 22

def wait_count
  @wait_count
end

#wait_kindObject

Returns the value of attribute wait_kind.



22
23
24
# File 'lib/hatchet/worker/durable_eviction/cache.rb', line 22

def wait_kind
  @wait_kind
end

#wait_resource_idObject

Returns the value of attribute wait_resource_id.



22
23
24
# File 'lib/hatchet/worker/durable_eviction/cache.rb', line 22

def wait_resource_id
  @wait_resource_id
end

#waiting_sinceObject

Returns the value of attribute waiting_since.



22
23
24
# File 'lib/hatchet/worker/durable_eviction/cache.rb', line 22

def waiting_since
  @waiting_since
end

Instance Method Details

#waiting?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/hatchet/worker/durable_eviction/cache.rb', line 42

def waiting?
  @wait_count.positive?
end