Documentation
¶
Overview ¶
Package inmem provides an in-memory implementation of memory.Store for testing and local development. Data is stored in process memory and is lost when the process exits. Production deployments should use a durable backend such as features/memory/mongo (MongoDB-backed implementation).
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 memory.Store using an in-process map keyed by agent ID and run ID. It is thread-safe and suitable for tests and local development. Data is not persisted across restarts.
The store maintains a two-level map: agentID -> runID -> events, allowing efficient isolation between agents and runs. All operations defensively copy data to prevent external mutation.
func New ¶
func New() *Store
New returns a new in-memory store instance with no events. The store is ready to use immediately and requires no initialization or cleanup.
func (*Store) AppendEvents ¶
func (s *Store) AppendEvents(_ context.Context, agentID, runID string, events ...memory.Event) error
AppendEvents appends the provided events to the run history. Events are copied defensively to ensure callers cannot mutate the internal store. If events is empty, this is a no-op.
Thread-safe: concurrent writes acquire an exclusive lock and serialize. Writes to different runs do not block each other but are still serialized within this implementation.
func (*Store) LoadRun ¶
LoadRun retrieves the snapshot for the given agent and run. Returns an empty snapshot (not an error) if the run doesn't exist, allowing callers to treat absence as empty history. The returned snapshot contains a defensive copy of events to prevent external mutation.
Thread-safe: concurrent reads are allowed and do not block each other.