memory

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package memory provides an in-memory lifecycle.Store for tests and process-local workflows. It is the reference implementation of the Store and Session contract but is not durable.

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, mutex-protected lifecycle.Store. It clones snapshots at every boundary and fences stale sessions with lifecycle.ErrOwnershipLost. It is not durable and cannot coordinate separate processes. The zero value is ready for use, and a Store is safe for concurrent use.

func NewStore

func NewStore() *Store

NewStore returns an empty Store.

func (*Store) Acquire

func (s *Store) Acquire(ctx context.Context, runID string) (lifecycle.Session, error)

Acquire returns an exclusive session for runID, or lifecycle.ErrRunOwned while another session owns it.

func (*Store) Load

func (s *Store) Load(ctx context.Context, runID string) (snapshot lifecycle.Snapshot, resultErr error)

Load acquires runID, loads its snapshot and releases it again. It is a convenience for inspecting a run that no session currently owns.

func (*Store) Save

func (s *Store) Save(ctx context.Context, snapshot lifecycle.Snapshot) (resultErr error)

Save acquires snapshot.RunID, saves the snapshot and releases it again. It is a convenience for seeding a run that no session currently owns.

Jump to

Keyboard shortcuts

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