dynamo

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package dynamo provides a DynamoDB-backed Storage adapter for Chronos.

It is built on the official AWS SDK for Go v2 (aws-sdk-go-v2). The previous implementation hand-rolled DynamoDB's JSON-1.0 REST protocol over net/http and did NOT sign requests with AWS Signature Version 4 (it merely set a bogus X-Amz-Access-Key header), so every call against real DynamoDB was rejected. Half of its methods were also stubs returning empty slices. This rewrite delegates signing, retries, endpoint resolution and (un)marshaling to the SDK.

Data model (single-table design)

Primary key : pk (S, HASH) + sk (S, RANGE)   — GetItem by entity id
GSI "owner-seq-index" : owner (S, HASH) + seq (N, RANGE) — list by parent

Each item stores the entity as a JSON blob in the "data" attribute. Items are grouped for listing via the owner attribute (e.g. AGENT#<id>, EVENTS#<sid>); the seq attribute orders them (creation time in millis, or event/checkpoint sequence number). Memory records also carry kind/mkey attributes so that GetMemory (by key) and ListMemory (by kind) can filter server-side.

Index

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 AWS DynamoDB.

func New

func New(endpoint, tableName, region, accessKey, secretKey string) (*Store, error)

New creates a DynamoDB storage adapter using AWS SigV4-signed requests.

If accessKey/secretKey are empty the default AWS credential chain is used (env, shared config, IAM role). For local development against DynamoDB Local pass endpoint "http://localhost:8000".

func NewWithClient added in v0.6.0

func NewWithClient(client api, tableName string) *Store

NewWithClient wraps a preconfigured client (or fake). Used for tests.

func (*Store) AppendAuditLog

func (s *Store) AppendAuditLog(ctx context.Context, log *storage.AuditLog) error

func (*Store) AppendEvent

func (s *Store) AppendEvent(ctx context.Context, e *storage.Event) error

func (*Store) Close

func (s *Store) Close() error

func (*Store) CreateSession

func (s *Store) CreateSession(ctx context.Context, sess *storage.Session) error

func (*Store) DeleteMemory

func (s *Store) DeleteMemory(ctx context.Context, id string) error

func (*Store) GetCheckpoint

func (s *Store) GetCheckpoint(ctx context.Context, id string) (*storage.Checkpoint, error)

func (*Store) GetLatestCheckpoint

func (s *Store) GetLatestCheckpoint(ctx context.Context, sessionID string) (*storage.Checkpoint, error)

func (*Store) GetMemory

func (s *Store) GetMemory(ctx context.Context, agentID, key string) (*storage.MemoryRecord, error)

func (*Store) GetSession

func (s *Store) GetSession(ctx context.Context, id string) (*storage.Session, error)

func (*Store) GetTrace

func (s *Store) GetTrace(ctx context.Context, id string) (*storage.Trace, error)

func (*Store) InsertTrace

func (s *Store) InsertTrace(ctx context.Context, t *storage.Trace) error

func (*Store) ListAuditLogs

func (s *Store) ListAuditLogs(ctx context.Context, sessionID string, limit, offset int) ([]*storage.AuditLog, error)

func (*Store) ListCheckpoints

func (s *Store) ListCheckpoints(ctx context.Context, sessionID string) ([]*storage.Checkpoint, error)

func (*Store) ListEvents

func (s *Store) ListEvents(ctx context.Context, sessionID string, afterSeq int64) ([]*storage.Event, error)

func (*Store) ListMemory

func (s *Store) ListMemory(ctx context.Context, agentID, kind string) ([]*storage.MemoryRecord, error)

func (*Store) ListSessions

func (s *Store) ListSessions(ctx context.Context, agentID string, limit, offset int) ([]*storage.Session, error)

func (*Store) ListTraces

func (s *Store) ListTraces(ctx context.Context, sessionID string) ([]*storage.Trace, error)

func (*Store) Migrate

func (s *Store) Migrate(ctx context.Context) error

Migrate creates the single Chronos table with the owner-seq GSI if it does not already exist.

func (*Store) PutMemory

func (s *Store) PutMemory(ctx context.Context, m *storage.MemoryRecord) error

func (*Store) SaveCheckpoint

func (s *Store) SaveCheckpoint(ctx context.Context, cp *storage.Checkpoint) error

func (*Store) UpdateSession

func (s *Store) UpdateSession(ctx context.Context, sess *storage.Session) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL