database

package
v1.98.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyID        = errors.New("memory ID cannot be empty")
	ErrMemoryNotFound = errors.New("memory not found")
)

Functions

func LockPathForDatabase added in v1.98.0

func LockPathForDatabase(dbPath string) string

LockPathForDatabase returns the companion lock-file path for a memory DB.

Types

type Database

type Database interface {
	AddMemory(ctx context.Context, memory UserMemory) error
	GetMemories(ctx context.Context) ([]UserMemory, error)
	DeleteMemory(ctx context.Context, memory UserMemory) error
	SearchMemories(ctx context.Context, query, category string) ([]UserMemory, error)
	UpdateMemory(ctx context.Context, memory UserMemory) error
}

type FileLock added in v1.98.0

type FileLock struct {
	// contains filtered or unexported fields
}

FileLock is an advisory file lock for coordinating memory database writes across docker-agent processes.

The lock file is intentionally never deleted. Keeping a stable sentinel file avoids a race where different processes lock different inodes for the same logical database.

func NewFileLock added in v1.98.0

func NewFileLock(path string) *FileLock

NewFileLock returns a lock using path as its persistent sentinel file.

func (*FileLock) Lock added in v1.98.0

func (l *FileLock) Lock(ctx context.Context) error

Lock blocks until the exclusive advisory lock is acquired or ctx is canceled.

func (*FileLock) Unlock added in v1.98.0

func (l *FileLock) Unlock() error

Unlock releases the advisory lock and closes the sentinel file descriptor.

type UserMemory

type UserMemory struct {
	ID        string `json:"id" description:"The ID of the memory"`
	CreatedAt string `json:"created_at" description:"The creation timestamp of the memory"`
	Memory    string `json:"memory" description:"The content of the memory"`
	Category  string `json:"category,omitempty" description:"The category of the memory"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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