Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
ID int `json:"id"`
Type EventType `json:"type"`
Workflow string `json:"workflow"` // Workflow Definition Name
StepName string `json:"step_name,omitempty"`
Payload []byte `json:"payload,omitempty"` // Serialized input/output
Error string `json:"error,omitempty"` // Error message if failed
Timestamp int64 `json:"timestamp"`
}
Event is a single immutable record in the journal.
type Journal ¶
type Journal interface {
// Append adds a new event to the journal.
Append(event Event) error
// Read returns all events for a given workflow instance history.
// In a real system, this might take an InstanceID.
// For this MVP, we assume a single-threaded access or single instance per journal for simplicity,
// or we can add InstanceID to the Event struct later.
// For now, let's treat the Journal as a stream for *one* execution or filter by workflow.
Read() ([]Event, error)
// Close cleans up resources working with the journal.
Close() error
}
Journal defines the storage interface for the execution engine.
type MemoryJournal ¶
type MemoryJournal struct {
// contains filtered or unexported fields
}
MemoryJournal is a simple thread-safe in-memory journal.
func NewMemoryJournal ¶
func NewMemoryJournal() *MemoryJournal
NewMemoryJournal creates a new empty in-memory journal.
func (*MemoryJournal) Append ¶
func (m *MemoryJournal) Append(event Event) error
Append adds an event to the history.
func (*MemoryJournal) Close ¶
func (m *MemoryJournal) Close() error
func (*MemoryJournal) Read ¶
func (m *MemoryJournal) Read() ([]Event, error)
Read returns a copy of the current history.
Click to show internal directories.
Click to hide internal directories.