Help us shape the future of Go! Take the 2026 Go Developer Survey

memmemory

package
v0.15.0 Latest Latest
Warning

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

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

Documentation

Overview

Package memmemory provides a concurrent in-memory reference implementation of tool.MemoryStore.

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, expected tool.MemoryVersion) (tool.MemoryRecord, error)

Forget 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) Remember added in v0.15.0

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

Remember atomically compares the complete current state before appending.

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) Undo added in v0.15.0

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

Undo 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