Documentation
¶
Overview ¶
Package state provides BadgerDB-based state management
Package state provides memory-based state management ¶
Package state provides interfaces for managing orchestrator state
Index ¶
- type BadgerStore
- func (s *BadgerStore) Close(ctx context.Context) error
- func (s *BadgerStore) CreateAgent(ctx context.Context, agent *types.Agent) error
- func (s *BadgerStore) CreateWorkflow(ctx context.Context, workflow *types.Workflow) error
- func (s *BadgerStore) DeleteAgent(ctx context.Context, agentID string) error
- func (s *BadgerStore) DeleteWorkflow(ctx context.Context, workflowID string) error
- func (s *BadgerStore) GetAgent(ctx context.Context, agentID string) (*types.Agent, error)
- func (s *BadgerStore) GetEvents(ctx context.Context, filter map[string]string, limit int) ([]*types.Event, error)
- func (s *BadgerStore) GetTask(ctx context.Context, workflowID, taskID string) (*types.Task, error)
- func (s *BadgerStore) GetWorkflow(ctx context.Context, workflowID string) (*types.Workflow, error)
- func (s *BadgerStore) HealthCheck(ctx context.Context) error
- func (s *BadgerStore) Initialize(ctx context.Context) error
- func (s *BadgerStore) ListAgents(ctx context.Context, filter map[string]string) ([]*types.Agent, error)
- func (s *BadgerStore) ListWorkflows(ctx context.Context, filter map[string]string) ([]*types.Workflow, error)
- func (s *BadgerStore) RecordEvent(ctx context.Context, event *types.Event) error
- func (s *BadgerStore) Transaction(ctx context.Context, fn func(tx StateManager) error) error
- func (s *BadgerStore) UpdateAgent(ctx context.Context, agent *types.Agent) error
- func (s *BadgerStore) UpdateTask(ctx context.Context, workflowID string, task *types.Task) error
- func (s *BadgerStore) UpdateWorkflow(ctx context.Context, workflow *types.Workflow) error
- type BadgerStoreConfig
- type BadgerStoreFactory
- type Config
- type Factory
- type MemoryStore
- func (s *MemoryStore) Close(ctx context.Context) error
- func (s *MemoryStore) CreateAgent(ctx context.Context, agent *types.Agent) error
- func (s *MemoryStore) CreateWorkflow(ctx context.Context, workflow *types.Workflow) error
- func (s *MemoryStore) DeleteAgent(ctx context.Context, agentID string) error
- func (s *MemoryStore) DeleteWorkflow(ctx context.Context, workflowID string) error
- func (s *MemoryStore) GetAgent(ctx context.Context, agentID string) (*types.Agent, error)
- func (s *MemoryStore) GetEvents(ctx context.Context, filter map[string]string, limit int) ([]*types.Event, error)
- func (s *MemoryStore) GetTask(ctx context.Context, workflowID, taskID string) (*types.Task, error)
- func (s *MemoryStore) GetWorkflow(ctx context.Context, workflowID string) (*types.Workflow, error)
- func (s *MemoryStore) HealthCheck(ctx context.Context) error
- func (s *MemoryStore) Initialize(ctx context.Context) error
- func (s *MemoryStore) ListAgents(ctx context.Context, filter map[string]string) ([]*types.Agent, error)
- func (s *MemoryStore) ListWorkflows(ctx context.Context, filter map[string]string) ([]*types.Workflow, error)
- func (s *MemoryStore) RecordEvent(ctx context.Context, event *types.Event) error
- func (s *MemoryStore) Transaction(ctx context.Context, fn func(tx StateManager) error) error
- func (s *MemoryStore) UpdateAgent(ctx context.Context, agent *types.Agent) error
- func (s *MemoryStore) UpdateTask(ctx context.Context, workflowID string, task *types.Task) error
- func (s *MemoryStore) UpdateWorkflow(ctx context.Context, workflow *types.Workflow) error
- type MemoryStoreFactory
- type StateManager
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadgerStore ¶
type BadgerStore struct {
// contains filtered or unexported fields
}
BadgerStore implements Store interface using BadgerDB
func NewBadgerStore ¶
func NewBadgerStore(config BadgerStoreConfig) (*BadgerStore, error)
NewBadgerStore creates a new BadgerDB-based store
func (*BadgerStore) Close ¶
func (s *BadgerStore) Close(ctx context.Context) error
Close closes the store
func (*BadgerStore) CreateAgent ¶
CreateAgent creates a new agent
func (*BadgerStore) CreateWorkflow ¶
CreateWorkflow creates a new workflow
func (*BadgerStore) DeleteAgent ¶
func (s *BadgerStore) DeleteAgent(ctx context.Context, agentID string) error
DeleteAgent removes an agent
func (*BadgerStore) DeleteWorkflow ¶
func (s *BadgerStore) DeleteWorkflow(ctx context.Context, workflowID string) error
DeleteWorkflow removes a workflow
func (*BadgerStore) GetEvents ¶
func (s *BadgerStore) GetEvents(ctx context.Context, filter map[string]string, limit int) ([]*types.Event, error)
GetEvents retrieves events matching the filter
func (*BadgerStore) GetWorkflow ¶
GetWorkflow retrieves a workflow by ID
func (*BadgerStore) HealthCheck ¶
func (s *BadgerStore) HealthCheck(ctx context.Context) error
HealthCheck performs a health check
func (*BadgerStore) Initialize ¶
func (s *BadgerStore) Initialize(ctx context.Context) error
Initialize initializes the store
func (*BadgerStore) ListAgents ¶
func (s *BadgerStore) ListAgents(ctx context.Context, filter map[string]string) ([]*types.Agent, error)
ListAgents returns agents matching the filter
func (*BadgerStore) ListWorkflows ¶
func (s *BadgerStore) ListWorkflows(ctx context.Context, filter map[string]string) ([]*types.Workflow, error)
ListWorkflows returns workflows matching the filter
func (*BadgerStore) RecordEvent ¶
RecordEvent records a system event
func (*BadgerStore) Transaction ¶
func (s *BadgerStore) Transaction(ctx context.Context, fn func(tx StateManager) error) error
Transaction executes a function within a transaction
func (*BadgerStore) UpdateAgent ¶
UpdateAgent updates an existing agent
func (*BadgerStore) UpdateTask ¶
UpdateTask updates a task within a workflow
func (*BadgerStore) UpdateWorkflow ¶
UpdateWorkflow updates an existing workflow
type BadgerStoreConfig ¶
BadgerStoreConfig holds BadgerDB-specific configuration
type BadgerStoreFactory ¶
type BadgerStoreFactory struct{}
BadgerStoreFactory creates BadgerDB store instances
type Config ¶
type Config struct {
Type string // "memory", "badger", "postgres", etc.
URL string // Connection URL for external stores
Path string // File path for embedded stores
Options map[string]interface{}
}
Config holds state store configuration
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore implements Store interface using in-memory storage
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
NewMemoryStore creates a new memory-based store
func (*MemoryStore) Close ¶
func (s *MemoryStore) Close(ctx context.Context) error
Close closes the store
func (*MemoryStore) CreateAgent ¶
CreateAgent creates a new agent
func (*MemoryStore) CreateWorkflow ¶
CreateWorkflow creates a new workflow
func (*MemoryStore) DeleteAgent ¶
func (s *MemoryStore) DeleteAgent(ctx context.Context, agentID string) error
DeleteAgent removes an agent
func (*MemoryStore) DeleteWorkflow ¶
func (s *MemoryStore) DeleteWorkflow(ctx context.Context, workflowID string) error
DeleteWorkflow removes a workflow
func (*MemoryStore) GetEvents ¶
func (s *MemoryStore) GetEvents(ctx context.Context, filter map[string]string, limit int) ([]*types.Event, error)
GetEvents retrieves events matching the filter
func (*MemoryStore) GetWorkflow ¶
GetWorkflow retrieves a workflow by ID
func (*MemoryStore) HealthCheck ¶
func (s *MemoryStore) HealthCheck(ctx context.Context) error
HealthCheck performs a health check
func (*MemoryStore) Initialize ¶
func (s *MemoryStore) Initialize(ctx context.Context) error
Initialize initializes the store
func (*MemoryStore) ListAgents ¶
func (s *MemoryStore) ListAgents(ctx context.Context, filter map[string]string) ([]*types.Agent, error)
ListAgents returns agents matching the filter
func (*MemoryStore) ListWorkflows ¶
func (s *MemoryStore) ListWorkflows(ctx context.Context, filter map[string]string) ([]*types.Workflow, error)
ListWorkflows returns workflows matching the filter
func (*MemoryStore) RecordEvent ¶
RecordEvent records a system event
func (*MemoryStore) Transaction ¶
func (s *MemoryStore) Transaction(ctx context.Context, fn func(tx StateManager) error) error
Transaction executes a function within a transaction
func (*MemoryStore) UpdateAgent ¶
UpdateAgent updates an existing agent
func (*MemoryStore) UpdateTask ¶
UpdateTask updates a task within a workflow
func (*MemoryStore) UpdateWorkflow ¶
UpdateWorkflow updates an existing workflow
type MemoryStoreFactory ¶
type MemoryStoreFactory struct{}
MemoryStoreFactory creates memory store instances
type StateManager ¶
type StateManager interface {
// Agent state management
CreateAgent(ctx context.Context, agent *types.Agent) error
GetAgent(ctx context.Context, agentID string) (*types.Agent, error)
UpdateAgent(ctx context.Context, agent *types.Agent) error
DeleteAgent(ctx context.Context, agentID string) error
ListAgents(ctx context.Context, filter map[string]string) ([]*types.Agent, error)
// Workflow state management
CreateWorkflow(ctx context.Context, workflow *types.Workflow) error
GetWorkflow(ctx context.Context, workflowID string) (*types.Workflow, error)
UpdateWorkflow(ctx context.Context, workflow *types.Workflow) error
DeleteWorkflow(ctx context.Context, workflowID string) error
ListWorkflows(ctx context.Context, filter map[string]string) ([]*types.Workflow, error)
// Task state management
GetTask(ctx context.Context, workflowID, taskID string) (*types.Task, error)
UpdateTask(ctx context.Context, workflowID string, task *types.Task) error
// Event management
RecordEvent(ctx context.Context, event *types.Event) error
GetEvents(ctx context.Context, filter map[string]string, limit int) ([]*types.Event, error)
// Transactional operations
Transaction(ctx context.Context, fn func(tx StateManager) error) error
}
StateManager defines the interface for state management