class ObjectFramework::ExecutionContext
Invocation metadata shared by execution, transport, and diagnostics. Inject it through the reserved context dependency; do not share sessions or this context with isolated tasks.
Attributes
Public Class Methods
Source
# File lib/object_framework/execution.rb, line 76 def initialize(cancellation: Cancellation.new) @operation_id = SecureRandom.uuid.freeze @cancellation, @started_at = cancellation, monotonic @transaction_state, @failure_reported = :none, false @mutex = Mutex.new end
Generates an operation UUID and records a monotonic start time.
Public Instance Methods
Source
# File lib/object_framework/execution.rb, line 88 def claim_failure @mutex.synchronize do return false if @failure_reported @failure_reported = true end end
Source
# File lib/object_framework/execution.rb, line 84 def elapsed monotonic - @started_at end
Returns the elapsed time in seconds since construction.