Documentation
¶
Overview ¶
Package redis provides a Redis-backed Storage adapter for Chronos.
It is built on the official go-redis client (github.com/redis/go-redis/v9), which handles RESP2/RESP3 framing, connection pooling, pipelining, TLS and reconnection correctly. The previous hand-rolled TCP/RESP implementation assumed every reply fit in a single 64KB Read and parsed replies with fragile string scanning; both bugs are eliminated by delegating the wire protocol to the maintained driver.
Data model: every record is stored as a JSON string under a namespaced key (chronos:<kind>:<id>). Secondary lookups (list-by-agent, list-by-session) are backed by per-owner sorted sets keyed by timestamp/sequence number so that listing is ordered and paginated without SCAN.
Index ¶
- type Store
- func (s *Store) AppendAuditLog(ctx context.Context, log *storage.AuditLog) error
- func (s *Store) AppendEvent(ctx context.Context, e *storage.Event) error
- func (s *Store) Close() error
- func (s *Store) CreateSession(ctx context.Context, sess *storage.Session) error
- func (s *Store) DeleteMemory(ctx context.Context, id string) error
- func (s *Store) GetCheckpoint(ctx context.Context, id string) (*storage.Checkpoint, error)
- func (s *Store) GetLatestCheckpoint(ctx context.Context, sessionID string) (*storage.Checkpoint, error)
- func (s *Store) GetMemory(ctx context.Context, agentID, key string) (*storage.MemoryRecord, error)
- func (s *Store) GetSession(ctx context.Context, id string) (*storage.Session, error)
- func (s *Store) GetTrace(ctx context.Context, id string) (*storage.Trace, error)
- func (s *Store) InsertTrace(ctx context.Context, t *storage.Trace) error
- func (s *Store) ListAuditLogs(ctx context.Context, sessionID string, limit, offset int) ([]*storage.AuditLog, error)
- func (s *Store) ListCheckpoints(ctx context.Context, sessionID string) ([]*storage.Checkpoint, error)
- func (s *Store) ListEvents(ctx context.Context, sessionID string, afterSeq int64) ([]*storage.Event, error)
- func (s *Store) ListMemory(ctx context.Context, agentID, kind string) ([]*storage.MemoryRecord, error)
- func (s *Store) ListSessions(ctx context.Context, agentID string, limit, offset int) ([]*storage.Session, error)
- func (s *Store) ListTraces(ctx context.Context, sessionID string) ([]*storage.Trace, error)
- func (s *Store) Migrate(_ context.Context) error
- func (s *Store) PutMemory(ctx context.Context, m *storage.MemoryRecord) error
- func (s *Store) SaveCheckpoint(ctx context.Context, cp *storage.Checkpoint) error
- func (s *Store) UpdateSession(ctx context.Context, sess *storage.Session) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements storage.Storage using Redis.
func NewWithClient ¶ added in v0.6.0
func NewWithClient(client redis.UniversalClient) *Store
NewWithClient wraps an existing go-redis client. Useful for tests (miniredis) and for callers that need custom connection options (TLS, cluster, pooling).