runtime

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2025 License: MIT Imports: 20 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BreakWithInPort added in v0.12.0

func BreakWithInPort(port *port.InPort) func(*Breakpoint)

BreakWithInPort sets the input port associated with the breakpoint.

func BreakWithOutPort added in v0.12.0

func BreakWithOutPort(port *port.OutPort) func(*Breakpoint)

BreakWithOutPort sets the output port associated with the breakpoint.

func BreakWithProcess added in v0.12.0

func BreakWithProcess(proc *process.Process) func(*Breakpoint)

BreakWithProcess sets the process associated with the breakpoint.

func BreakWithSymbol added in v0.12.0

func BreakWithSymbol(sb *symbol.Symbol) func(*Breakpoint)

BreakWithSymbol sets the symbol associated with the breakpoint.

Types

type Agent added in v0.12.0

type Agent struct {
	// contains filtered or unexported fields
}

Agent manages symbols, processes, and hooks for ports and packets.

func NewAgent added in v0.12.0

func NewAgent() *Agent

NewAgent initializes and returns a new Agent.

func (*Agent) Close added in v0.12.0

func (a *Agent) Close()

Close clears all symbols, processes, and registered watchers.

func (*Agent) Frames added in v0.12.0

func (a *Agent) Frames(id uuid.UUID) []*Frame

Frames returns the frames associated with a specific process UUID.

func (*Agent) Load added in v0.12.0

func (a *Agent) Load(sym *symbol.Symbol) error

Load registers a symbol and its associated hooks for inbound and outbound ports.

func (*Agent) Process added in v0.12.0

func (a *Agent) Process(id uuid.UUID) *process.Process

Process returns a process by UUID.

func (*Agent) Processes added in v0.12.0

func (a *Agent) Processes() []*process.Process

Processes returns a list of all registered processes.

func (*Agent) Symbol added in v0.12.0

func (a *Agent) Symbol(id uuid.UUID) *symbol.Symbol

Symbol returns a symbol by UUID.

func (*Agent) Symbols added in v0.12.0

func (a *Agent) Symbols() []*symbol.Symbol

Symbols returns a list of all registered symbols.

func (*Agent) Unload added in v0.12.0

func (a *Agent) Unload(sym *symbol.Symbol) error

Unload removes a symbol and its hooks.

func (*Agent) Unwatch added in v0.12.0

func (a *Agent) Unwatch(watcher Watcher) bool

Unwatch removes a watcher. Returns true if the watcher is successfully removed.

func (*Agent) Watch added in v0.12.0

func (a *Agent) Watch(watcher Watcher) bool

Watch registers a new watcher. Returns false if the watcher is already registered.

type Breakpoint added in v0.12.0

type Breakpoint struct {
	// contains filtered or unexported fields
}

Breakpoint represents a synchronization point in a process where execution can be paused and resumed.

func NewBreakpoint added in v0.12.0

func NewBreakpoint(options ...func(*Breakpoint)) *Breakpoint

NewBreakpoint creates a new Breakpoint with optional configurations.

func (*Breakpoint) Close added in v0.12.0

func (b *Breakpoint) Close()

Close cleans up resources.

func (*Breakpoint) Done added in v0.12.0

func (b *Breakpoint) Done() bool

Done completes the current frame's processing.

func (*Breakpoint) Frame added in v0.12.0

func (b *Breakpoint) Frame() *Frame

Frame returns the current frame under lock protection.

func (*Breakpoint) ID added in v0.12.0

func (b *Breakpoint) ID() uuid.UUID

ID returns the unique identifier of the breakpoint.

func (*Breakpoint) InPort added in v0.12.0

func (b *Breakpoint) InPort() *port.InPort

InPort returns the associated input port.

func (*Breakpoint) MarshalJSON added in v0.14.0

func (b *Breakpoint) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the Breakpoint type.

func (*Breakpoint) Next added in v0.12.0

func (b *Breakpoint) Next() bool

Next advances to the next frame, returning false if closed.

func (*Breakpoint) OnFrame added in v0.12.0

func (b *Breakpoint) OnFrame(frame *Frame)

OnFrame processes an incoming frame and synchronizes it.

func (*Breakpoint) OnProcess added in v0.12.0

func (b *Breakpoint) OnProcess(*process.Process)

OnProcess is a no-op but required by the Watcher interface.

func (*Breakpoint) OutPort added in v0.12.0

func (b *Breakpoint) OutPort() *port.OutPort

OutPort returns the associated output port.

func (*Breakpoint) Process added in v0.12.0

func (b *Breakpoint) Process() *process.Process

Process returns the associated process.

func (*Breakpoint) Symbol added in v0.12.0

func (b *Breakpoint) Symbol() *symbol.Symbol

Symbol returns the associated symbol.

type Config

type Config struct {
	Namespace   string            // Namespace defines the isolated execution environment for workflows.
	Environment map[string]string // Environment holds the variables for the loader.
	Hook        *hook.Hook        // Hook is a collection of hook functions for managing symbols.
	Scheme      *scheme.Scheme    // Scheme defines the scheme and behaviors for symbols.
	SpecStore   driver.Store      // SpecStore is responsible for persisting specifications.
	ValueStore  driver.Store      // ValueStore is responsible for persisting values.
}

Config defines configuration options for the Runtime.

type Debugger added in v0.12.0

type Debugger struct {
	// contains filtered or unexported fields
}

Debugger manages breakpoints and the debugging process.

func NewDebugger added in v0.12.0

func NewDebugger(agent *Agent) *Debugger

NewDebugger creates a new Debugger instance with the specified agent.

func (*Debugger) AddBreakpoint added in v0.12.0

func (d *Debugger) AddBreakpoint(bp *Breakpoint) bool

AddBreakpoint adds a breakpoint and starts monitoring it.

func (*Debugger) Breakpoint added in v0.12.0

func (d *Debugger) Breakpoint() *Breakpoint

Breakpoint returns the currently active breakpoint.

func (*Debugger) Breakpoints added in v0.12.0

func (d *Debugger) Breakpoints() []*Breakpoint

Breakpoints returns all registered breakpoints.

func (*Debugger) Close added in v0.12.0

func (d *Debugger) Close()

Close stops monitoring breakpoints and releases resources.

func (*Debugger) Frame added in v0.12.0

func (d *Debugger) Frame() *Frame

Frame returns the frame of the current breakpoint.

func (*Debugger) Pause added in v0.12.0

func (d *Debugger) Pause(ctx context.Context) bool

Pause blocks until a breakpoint is hit or monitoring is done.

func (*Debugger) Process added in v0.12.0

func (d *Debugger) Process() *process.Process

Process retrieves the process linked to the current breakpoint.

func (*Debugger) RemoveBreakpoint added in v0.12.0

func (d *Debugger) RemoveBreakpoint(bp *Breakpoint) bool

RemoveBreakpoint deletes the specified breakpoint.

func (*Debugger) Step added in v0.12.0

func (d *Debugger) Step(ctx context.Context) bool

Step continues execution until the next breakpoint is hit.

func (*Debugger) Symbol added in v0.12.0

func (d *Debugger) Symbol() *symbol.Symbol

Symbol retrieves the symbol for the frame at the current breakpoint.

type Frame added in v0.12.0

type Frame struct {
	Process *process.Process // The associated process handling this frame.
	Symbol  *symbol.Symbol   // The symbol or metadata relevant to the current processing state.

	InPort  *port.InPort  // Input port that receives the packet.
	OutPort *port.OutPort // Output port that sends the processed packet.

	InPck  *packet.Packet // The incoming packet being processed.
	OutPck *packet.Packet // The outgoing packet generated after processing.

	InTime  time.Time // Timestamp when the input packet was received.
	OutTime time.Time // Timestamp when the output packet was sent.
}

Frame represents a processing unit that links a process with its input and output packets.

func (*Frame) MarshalJSON added in v0.14.0

func (f *Frame) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the Frame type.

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime represents an environment for executing Workflows.

func New

func New(config Config) *Runtime

New creates a new Runtime instance with the specified configuration.

func (*Runtime) Close

func (r *Runtime) Close(ctx context.Context) error

Close shuts down the Runtime by closing streams and clearing the symbol table.

func (*Runtime) Load

func (r *Runtime) Load(ctx context.Context, filter any) error

Load loads symbols from the spec store into the symbol table.

func (*Runtime) Reconcile added in v0.11.0

func (r *Runtime) Reconcile(ctx context.Context) error

Reconcile reconciles the state of symbols based on changes in specifications and values.

func (*Runtime) Watch added in v0.11.0

func (r *Runtime) Watch(ctx context.Context) error

Watch sets up watchers for specification and value changes.

type Watcher added in v0.12.0

type Watcher interface {
	// OnFrame is triggered when a Frame event occurs.
	OnFrame(*Frame)
	// OnProcess is triggered when a Process event occurs.
	OnProcess(*process.Process)
}

Watcher defines methods for handling Frame and Process events.

func NewFrameWatcher added in v0.12.0

func NewFrameWatcher(handle func(*Frame)) Watcher

NewFrameWatcher creates a Watcher for handling Frame events.

func NewProcessWatcher added in v0.12.0

func NewProcessWatcher(handle func(*process.Process)) Watcher

NewProcessWatcher creates a Watcher for handling Process events.

type Watchers added in v0.12.0

type Watchers []Watcher

Watchers is a slice of Watcher interfaces.

func (Watchers) OnFrame added in v0.12.0

func (w Watchers) OnFrame(frame *Frame)

OnFrame triggers the OnFrame method for each Watcher in the slice.

func (Watchers) OnProcess added in v0.12.0

func (w Watchers) OnProcess(proc *process.Process)

OnProcess triggers the OnProcess method for each Watcher in the slice.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL