Documentation
¶
Index ¶
- type ConsulStorage
- func (c *ConsulStorage) Cleanup(ctx context.Context, olderThan time.Duration) error
- func (c *ConsulStorage) Close() error
- func (c *ConsulStorage) Create(ctx context.Context, exec *Execution) error
- func (c *ConsulStorage) Delete(ctx context.Context, id string) error
- func (c *ConsulStorage) Get(ctx context.Context, id string) (*Execution, error)
- func (c *ConsulStorage) List(ctx context.Context, status *client.ExecutionStatus) ([]*Execution, error)
- func (c *ConsulStorage) Update(ctx context.Context, exec *Execution) error
- type Execution
- type MemoryStorage
- func (m *MemoryStorage) Cleanup(ctx context.Context, olderThan time.Duration) error
- func (m *MemoryStorage) Close() error
- func (m *MemoryStorage) Create(ctx context.Context, exec *Execution) error
- func (m *MemoryStorage) Delete(ctx context.Context, id string) error
- func (m *MemoryStorage) Get(ctx context.Context, id string) (*Execution, error)
- func (m *MemoryStorage) List(ctx context.Context, status *client.ExecutionStatus) ([]*Execution, error)
- func (m *MemoryStorage) Update(ctx context.Context, exec *Execution) error
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsulStorage ¶
type ConsulStorage struct {
// contains filtered or unexported fields
}
ConsulStorage implements storage using Consul KV
func NewConsulStorage ¶
func NewConsulStorage(address, token, keyPrefix string) (*ConsulStorage, error)
NewConsulStorage creates a new Consul-backed storage
func (*ConsulStorage) Create ¶
func (c *ConsulStorage) Create(ctx context.Context, exec *Execution) error
Create creates a new execution record
func (*ConsulStorage) Delete ¶
func (c *ConsulStorage) Delete(ctx context.Context, id string) error
Delete removes an execution
func (*ConsulStorage) List ¶
func (c *ConsulStorage) List(ctx context.Context, status *client.ExecutionStatus) ([]*Execution, error)
List returns all executions (optionally filtered by status)
type Execution ¶
type Execution struct {
ID string
Status client.ExecutionStatus
Metadata *client.Metadata
Stdout string
Stderr string
ExitCode int
Error string
ErrorType string // Python error type (e.g., "SyntaxError", "NameError")
ErrorLine int // Line number where error occurred
Result *string // REPL-style result of last expression
StartedAt *time.Time
FinishedAt *time.Time
DurationMs int64
ContainerID string // Docker container ID for running executions
CreatedAt time.Time
}
Execution represents a stored execution state
func (*Execution) ToExecutionResult ¶
func (e *Execution) ToExecutionResult() *client.ExecutionResult
ToExecutionResult converts a storage Execution to a client ExecutionResult
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
MemoryStorage implements in-memory storage with mutex protection
func NewMemoryStorage ¶
func NewMemoryStorage() *MemoryStorage
NewMemoryStorage creates a new in-memory storage backend
func (*MemoryStorage) Close ¶
func (m *MemoryStorage) Close() error
Close is a no-op for memory storage
func (*MemoryStorage) Create ¶
func (m *MemoryStorage) Create(ctx context.Context, exec *Execution) error
Create creates a new execution record
func (*MemoryStorage) Delete ¶
func (m *MemoryStorage) Delete(ctx context.Context, id string) error
Delete removes an execution
func (*MemoryStorage) List ¶
func (m *MemoryStorage) List(ctx context.Context, status *client.ExecutionStatus) ([]*Execution, error)
List returns all executions (optionally filtered by status)
type Storage ¶
type Storage interface {
// Create creates a new execution record
Create(ctx context.Context, exec *Execution) error
// Get retrieves an execution by ID
Get(ctx context.Context, id string) (*Execution, error)
// Update updates an existing execution
Update(ctx context.Context, exec *Execution) error
// Delete removes an execution
Delete(ctx context.Context, id string) error
// List returns all executions (optionally filtered by status)
List(ctx context.Context, status *client.ExecutionStatus) ([]*Execution, error)
// Cleanup removes executions older than the given duration
Cleanup(ctx context.Context, olderThan time.Duration) error
// Close closes the storage backend
Close() error
}
Storage defines the interface for execution state storage