Documentation
¶
Index ¶
- func DeserializeCheckpoint(data []byte) (*agentorcav1alpha1.Checkpoint, error)
- func SerializeCheckpoint(cp *agentorcav1alpha1.Checkpoint) ([]byte, error)
- type InMemoryStore
- func (s *InMemoryStore) Delete(ctx context.Context, sessionID string) error
- func (s *InMemoryStore) List(ctx context.Context) ([]string, error)
- func (s *InMemoryStore) Load(ctx context.Context, sessionID string) (*agentorcav1alpha1.Checkpoint, error)
- func (s *InMemoryStore) Save(ctx context.Context, checkpoint *agentorcav1alpha1.Checkpoint) (string, error)
- type RedisStore
- func (s *RedisStore) Delete(ctx context.Context, sessionID string) error
- func (s *RedisStore) List(ctx context.Context) ([]string, error)
- func (s *RedisStore) Load(ctx context.Context, sessionID string) (*agentorcav1alpha1.Checkpoint, error)
- func (s *RedisStore) Save(ctx context.Context, checkpoint *agentorcav1alpha1.Checkpoint) (string, error)
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeserializeCheckpoint ¶
func DeserializeCheckpoint(data []byte) (*agentorcav1alpha1.Checkpoint, error)
DeserializeCheckpoint decodes a checkpoint from JSON.
func SerializeCheckpoint ¶
func SerializeCheckpoint(cp *agentorcav1alpha1.Checkpoint) ([]byte, error)
SerializeCheckpoint encodes a checkpoint to JSON (for storage).
Types ¶
type InMemoryStore ¶
type InMemoryStore struct {
// contains filtered or unexported fields
}
InMemoryStore is a simple in-memory checkpoint store for development and testing. NOT suitable for production (data is lost on pod restart).
func NewInMemoryStore ¶
func NewInMemoryStore() *InMemoryStore
NewInMemoryStore creates a new in-memory checkpoint store.
func (*InMemoryStore) Delete ¶
func (s *InMemoryStore) Delete(ctx context.Context, sessionID string) error
Delete removes a checkpoint from memory.
func (*InMemoryStore) List ¶
func (s *InMemoryStore) List(ctx context.Context) ([]string, error)
List returns all session IDs.
func (*InMemoryStore) Load ¶
func (s *InMemoryStore) Load(ctx context.Context, sessionID string) (*agentorcav1alpha1.Checkpoint, error)
Load retrieves a checkpoint from memory.
func (*InMemoryStore) Save ¶
func (s *InMemoryStore) Save(ctx context.Context, checkpoint *agentorcav1alpha1.Checkpoint) (string, error)
Save persists a checkpoint to memory.
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
RedisStore implements Store against a state-store KV backend (Redis in production). It makes session checkpoints survive API-server / warm-pod restarts, which is required for the LastRunRef conversation chain to persist: when the apiserver restarts it must still know each session's last run so the next AgentRun is created with PriorRunRef set and the model-router can rehydrate context from Redis on the next warm-pod claim.
func NewRedisStore ¶
func NewRedisStore(kv kvStore) *RedisStore
NewRedisStore creates a Redis-backed (state-store-backed) session checkpoint store. kv must be non-nil; in production pass the operator's state.Store.
func (*RedisStore) Delete ¶
func (s *RedisStore) Delete(ctx context.Context, sessionID string) error
Delete removes a session checkpoint. No-op for unknown/empty IDs.
func (*RedisStore) List ¶
func (s *RedisStore) List(ctx context.Context) ([]string, error)
List returns all known session IDs (for cleanup/metrics).
func (*RedisStore) Load ¶
func (s *RedisStore) Load(ctx context.Context, sessionID string) (*agentorcav1alpha1.Checkpoint, error)
Load retrieves a session checkpoint by ID. Returns (nil, nil) when not found.
func (*RedisStore) Save ¶
func (s *RedisStore) Save(ctx context.Context, checkpoint *agentorcav1alpha1.Checkpoint) (string, error)
Save persists (overwrites) a session checkpoint with a bounded TTL.
type Store ¶
type Store interface {
// Load retrieves a checkpoint by session ID.
// Returns nil checkpoint and no error if not found (not an error condition).
Load(ctx context.Context, sessionID string) (*agentorcav1alpha1.Checkpoint, error)
// Save persists a checkpoint. Overwrites any existing checkpoint for the same sessionID.
Save(ctx context.Context, checkpoint *agentorcav1alpha1.Checkpoint) (checkpointRef string, error error)
// Delete removes a checkpoint by session ID.
Delete(ctx context.Context, sessionID string) error
// List returns all session IDs (for cleanup, metrics, etc). Optional to implement.
List(ctx context.Context) ([]string, error)
}
Store defines the interface for persisting and retrieving conversation checkpoints. Implementations can be backed by S3, GCS, local filesystem, etcd, or in-memory storage.