Class: Liteguard::Execution

Inherits:
Object
  • Object
show all
Defined in:
lib/liteguard/decision.rb

Overview

A lightweight execution correlation handle.

Groups telemetry signals under a shared execution ID. Created by Scope#start_execution or Client#start_execution. Call #end_execution when the logical execution boundary is complete.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(execution_id, cleanup: nil) ⇒ Execution

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Execution.



17
18
19
20
# File 'lib/liteguard/decision.rb', line 17

def initialize(execution_id, cleanup: nil)
  @execution_id = execution_id
  @cleanup = cleanup
end

Instance Attribute Details

#execution_idString (readonly)

Returns the unique identifier for this execution.

Returns:

  • (String)

    the unique identifier for this execution



14
15
16
# File 'lib/liteguard/decision.rb', line 14

def execution_id
  @execution_id
end

Instance Method Details

#end_executionvoid

This method returns an undefined value.

End this execution.

After calling end_execution, subsequent guard checks will no longer be correlated with this execution.



27
28
29
30
31
32
# File 'lib/liteguard/decision.rb', line 27

def end_execution
  if @cleanup
    @cleanup.call
    @cleanup = nil
  end
end