memory

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package memory is the in-memory ManifestStore and OperationalStore adapter used by tests and by the conformance suite. It has no persistence: state lives only as long as the process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyJournal

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

ApplyJournal is the in-memory adapter for store.ApplyJournal.

func NewApplyJournal

func NewApplyJournal() *ApplyJournal

NewApplyJournal creates a new in-memory ApplyJournal.

func (*ApplyJournal) ListUnapplied

func (j *ApplyJournal) ListUnapplied(_ context.Context) ([]store.ApplyUnit, error)

ListUnapplied returns every unit with applied=false, oldest first.

func (*ApplyJournal) MarkApplied

func (j *ApplyJournal) MarkApplied(_ context.Context, unitID string) error

MarkApplied marks a unit as applied.

func (*ApplyJournal) PruneOld

func (j *ApplyJournal) PruneOld(_ context.Context, keepCount int) error

PruneOld removes applied units older than keepCount (keeps the most recent). A keepCount of 0 or less means unlimited (no pruning).

func (*ApplyJournal) PutUnit

func (j *ApplyJournal) PutUnit(_ context.Context, unit store.ApplyUnit) error

PutUnit writes a new unit with applied=false.

func (*ApplyJournal) WithinTransaction

func (j *ApplyJournal) WithinTransaction(ctx context.Context, fn func(ctx context.Context, tx store.ApplyJournal) error) error

WithinTransaction runs fn. Memory adapter doesn't need true transactions.

type BundleStore

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

BundleStore keeps handoff bundles in memory: what a test needs to prove a handoff recorded what it rendered, without a directory.

func NewBundleStore

func NewBundleStore() *BundleStore

NewBundleStore returns an empty BundleStore.

func (*BundleStore) Get

func (b *BundleStore) Get(location, name string) ([]byte, bool)

Get returns one stored file, for tests.

func (*BundleStore) PutBundle

func (b *BundleStore) PutBundle(_ context.Context, projectID string, version int, files map[string][]byte) (store.Bundle, error)

PutBundle stores files under "handoff/<project>/v<n>".

type ManifestStore

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

ManifestStore is the in-memory adapter for store.ManifestStore.

func NewManifestStore

func NewManifestStore() *ManifestStore

func (*ManifestStore) Counts

func (m *ManifestStore) Counts(_ context.Context) (map[string]int, error)

func (*ManifestStore) Exclude

func (m *ManifestStore) Exclude(_ context.Context, kind, id, name, reason, operator string) error

Exclude records an exclusion for a manifest.

func (*ManifestStore) GetCurrent

func (m *ManifestStore) GetCurrent(_ context.Context, kind, id string) (store.Version, bool, error)

func (*ManifestStore) GetVersion

func (m *ManifestStore) GetVersion(_ context.Context, kind, id string, number int) (store.Version, bool, error)

func (*ManifestStore) GetWorking

func (m *ManifestStore) GetWorking(_ context.Context, kind, id string) ([]byte, bool, error)

GetWorking returns a manifest's working copy (autosave without versioning). Returns found=false when none exists.

func (*ManifestStore) IndexReferences

func (m *ManifestStore) IndexReferences(_ context.Context, fromKind, fromID string, refs []store.Ref) error

func (*ManifestStore) ListAllVersions

func (m *ManifestStore) ListAllVersions(_ context.Context, limit int, cursor string) ([]store.Version, string, error)

func (*ManifestStore) ListExcluded

func (m *ManifestStore) ListExcluded(_ context.Context) ([]store.Exclusion, error)

ListExcluded returns every excluded manifest, newest first.

func (*ManifestStore) ListIDs

func (m *ManifestStore) ListIDs(_ context.Context, kind string) ([]string, error)

func (*ManifestStore) ListReferencedBy

func (m *ManifestStore) ListReferencedBy(_ context.Context, fromKind, fromID string) ([]store.Ref, error)

func (*ManifestStore) ListReferencing

func (m *ManifestStore) ListReferencing(_ context.Context, toKind, toID string) ([]store.Summary, error)

func (*ManifestStore) ListSummaries

func (m *ManifestStore) ListSummaries(_ context.Context, kind, query string, refs []store.RefFilter) ([]store.Summary, error)

func (*ManifestStore) ListVersions

func (m *ManifestStore) ListVersions(_ context.Context, kind, id string) ([]store.Version, error)

func (*ManifestStore) PutVersion

func (m *ManifestStore) PutVersion(_ context.Context, v store.Version) error

func (*ManifestStore) PutWorking

func (m *ManifestStore) PutWorking(_ context.Context, kind, id string, yamlBytes []byte) error

PutWorking stores a manifest's working copy (autosave without versioning).

func (*ManifestStore) Recover

func (m *ManifestStore) Recover(_ context.Context, kind, id, reason, operator string) error

Recover deletes an exclusion record.

func (*ManifestStore) WithinTransaction

func (m *ManifestStore) WithinTransaction(ctx context.Context, fn func(ctx context.Context, tx store.ManifestStore) error) error

WithinTransaction is a best-effort transaction: the in-memory store holds one global lock for the duration of fn, and rolls back by snapshotting and restoring state if fn returns an error. This gives the same all-or-nothing guarantee the SQLite adapter gives, without needing a real transaction manager for a map.

type OpLog

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

OpLog is the in-memory store.OpLog, for tests and for a single-process deployment that accepts losing the shared draft on restart (the committed versions are never in the log).

func NewOpLog

func NewOpLog() *OpLog

NewOpLog returns an empty OpLog.

func (*OpLog) Append

func (l *OpLog) Append(_ context.Context, ops []store.Op) (int64, error)

func (*OpLog) Compact

func (l *OpLog) Compact(_ context.Context, kind, id string, seq int64) error

func (*OpLog) Latest

func (l *OpLog) Latest(_ context.Context, kind, id string) (int64, error)

func (*OpLog) Since

func (l *OpLog) Since(_ context.Context, kind, id string, after int64, limit int) ([]store.Op, error)

type OperationalStore

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

OperationalStore is the in-memory adapter for store.OperationalStore.

func NewOperationalStore

func NewOperationalStore() *OperationalStore

func (*OperationalStore) ListProjectStateHistory

func (o *OperationalStore) ListProjectStateHistory(_ context.Context, projectID string) ([]store.ProjectStateEntry, error)

func (*OperationalStore) PutProjectStateTransition

func (o *OperationalStore) PutProjectStateTransition(_ context.Context, e store.ProjectStateEntry) error

Jump to

Keyboard shortcuts

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