Documentation
¶
Index ¶
- Variables
- type Instance
- func (i *Instance) Bus() *event.Bus
- func (i *Instance) CancelExecution(ctx context.Context, executionID shared.ID, reason error) error
- func (i *Instance) EventStore() *event.Store
- func (i *Instance) Events(ctx context.Context, eventID shared.ID, after shared.ID) (<-chan stream.Message, error)
- func (i *Instance) Execute(ctx context.Context, input map[string]any) (*execution.Execution, error)
- func (i *Instance) GetExecution(id shared.ID) (*execution.Execution, bool)
- func (i *Instance) ListExecutionEvents(ctx context.Context, executionID shared.ID) ([]event.Event, error)
- func (i *Instance) ListExecutions() []*execution.Execution
- func (i *Instance) Start() error
- func (i *Instance) Status() Status
- func (i *Instance) Stop() error
- func (i *Instance) Store() contracts.ExecutionRepository
- type Manager
- func (m *Manager) Clear(ctx context.Context) error
- func (m *Manager) Get(key protocol.InstanceKey) (*Instance, bool)
- func (m *Manager) GetByID(id string) (*Instance, bool)
- func (m *Manager) GetOrCreate(ctx context.Context, key protocol.InstanceKey) (*Instance, bool, error)
- func (m *Manager) List(opts protocol.ListOptions) []*Instance
- func (m *Manager) Remove(ctx context.Context, target string) (removed bool, err error)
- func (m *Manager) RemoveByAssembly(ctx context.Context, key protocol.InstanceKey) (int, error)
- func (m *Manager) Resolve(ctx context.Context, key protocol.InstanceKey) (*Instance, bool)
- func (m *Manager) Stop(id string) error
- type Option
- type Status
Constants ¶
This section is empty.
Variables ¶
var ErrExecutionNotCancellable = errors.New("execution already reached a terminal state")
ErrExecutionNotCancellable reports that an execution cannot be cancelled because it has already reached a terminal state. It is deliberately distinct from ErrExecutionNotFound: the execution exists and a client can read its outcome, it simply cannot be stopped any more.
var ErrExecutionNotFound = errors.New("execution was not found")
ErrExecutionNotFound reports that no execution carries the requested ID on this instance.
Functions ¶
This section is empty.
Types ¶
type Instance ¶
type Instance struct {
ID string
Key protocol.InstanceKey
Blueprint *types.ExecutionBlueprint
// contains filtered or unexported fields
}
func (*Instance) CancelExecution ¶
CancelExecution stops an execution at the caller's request.
Cancellation goes through the scheduler when one exists, because the scheduler owns execution scopes: it is the component that bound the scope when the execution started, so it is the one that can cancel it and record the decision. A restored instance has no scheduler -- and therefore no work to stop -- so there the execution's record is simply corrected and persisted.
func (*Instance) EventStore ¶
func (*Instance) Events ¶
func (i *Instance) Events(ctx context.Context, eventID shared.ID, after shared.ID) (<-chan stream.Message, error)
Events composes persisted history with live bus events for the execution.
func (*Instance) GetExecution ¶
func (*Instance) ListExecutionEvents ¶
func (*Instance) ListExecutions ¶
func (*Instance) Store ¶
func (i *Instance) Store() contracts.ExecutionRepository
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) GetOrCreate ¶
func (m *Manager) GetOrCreate(ctx context.Context, key protocol.InstanceKey) (*Instance, bool, error)
GetOrCreate returns the live runtime for key, lazily constructing it from the durable RegisteredAssembly when it is not already running. Registration itself never creates an instance; this is the only entry point that does. The key may be partial (assemblyID, assemblyID:latest, assemblyID:version); it is resolved to its canonical form first so every addressing style shares the same runtime.
func (*Manager) Remove ¶
Remove stops and removes the instance addressed by target (an instance ID or a colon-encoded assembly key). The instance's executions and events are deleted along with its durable metadata.
func (*Manager) RemoveByAssembly ¶
RemoveByAssembly stops and removes every instance whose key addresses the given assembly, optionally scoped to the key's version. Returns the number of instances removed.
func (*Manager) Resolve ¶
Resolve returns the live runtime for key without creating it. An exact key matches directly; a partial key (name, name:version, or one carrying a hash or env) is resolved through the registered assemblies so version-without-hash addresses the most recently registered artifact. Returns false when no instance exists for the key.
type Option ¶
type Option func(*options)
Option configures an Instance at construction time.
func WithDetachedDrainTimeout ¶
WithDetachedDrainTimeout sets how long detached capability work may continue after the instance stops. Detached work outlives its caller by design, so draining it is bounded rather than unlimited; a non-positive duration selects the engine default.
func WithResolvedCapabilityRuntimes ¶
func WithResolvedCapabilityRuntimes(resolved []capabilityrt.ResolvedCapabilityRuntime) Option
WithResolvedCapabilityRuntimes supplies the frozen capability runtime set persisted with the assembly's registration.