memmemory

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package memmemory provides a concurrent in-memory reference implementation of tool.MemoryStore and its optional tool.MemoryLifecycleStore capability.

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 is a process-local memory store. It is safe for concurrent use.

func New

func New() *Store

New returns an empty in-memory store.

func (*Store) Forget

func (s *Store) Forget(ctx context.Context, key string) error

Forget unconditionally deletes an active legacy entry. The tombstone remains available through Inspect; deleting a missing key is a no-op.

func (*Store) ForgetVersioned

func (s *Store) ForgetVersioned(ctx context.Context, key string, expected tool.MemoryVersion) (tool.MemoryRecord, error)

ForgetVersioned atomically appends a deletion when expected is current.

func (*Store) Index

func (s *Store) Index(ctx context.Context) ([]tool.MemoryEntry, error)

Index returns active routing entries with values omitted.

func (*Store) Inspect

func (s *Store) Inspect(ctx context.Context, key string) (tool.MemoryRecord, bool, error)

Inspect returns current state and complete history, including tombstones.

func (*Store) List

func (s *Store) List(ctx context.Context, prefix string) ([]tool.MemoryEntry, error)

List returns full active entries matching prefix in key order.

func (*Store) Recall

func (s *Store) Recall(ctx context.Context, key string) (tool.MemoryEntry, bool, error)

Recall returns the active value for key. Deleted records are legacy misses.

func (*Store) RememberEntry

func (s *Store) RememberEntry(ctx context.Context, entry tool.MemoryEntry) error

RememberEntry preserves the legacy MemoryStore behavior: only blank keys are rejected and writes overwrite unconditionally.

func (*Store) RememberIfCurrent

func (s *Store) RememberIfCurrent(ctx context.Context, entry tool.MemoryEntry, expected tool.MemoryCurrent) (tool.MemoryRecord, error)

RememberIfCurrent atomically compares presence and version before appending.

func (*Store) RememberVersioned

func (s *Store) RememberVersioned(ctx context.Context, entry tool.MemoryEntry, expected tool.MemoryVersion) (tool.MemoryRecord, error)

RememberVersioned atomically creates or replaces an active record when its current version equals expected.

func (*Store) Search

func (s *Store) Search(ctx context.Context, query string, k int) ([]tool.MemoryEntry, error)

Search performs deterministic case-insensitive lexical matching over active keys, descriptions, and values.

func (*Store) UndoLatest

func (s *Store) UndoLatest(ctx context.Context, key string, expected tool.MemoryVersion) (tool.MemoryRecord, error)

UndoLatest atomically appends a compensating revision restoring the state immediately before the current revision.

Jump to

Keyboard shortcuts

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