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

memledger

package
v0.14.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: 3 Imported by: 0

Documentation

Overview

Package memledger provides a concurrent in-memory reference implementation of tool.ReadLedger (ADR 0294). It is the default a Workspace selects when no durable ledger is configured, and the offline fixture the shared engine/adapter/ledgerconformance suite validates. It never returns tool.ErrLedgerUnavailable: an in-memory map cannot go unavailable or corrupt, so RecordRead/RecordedVersion only ever succeed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ledger

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

Ledger is a concurrency-safe in-memory tool.ReadLedger. Each Ledger instance is an independent evidence scope: two Ledgers never share state, which is what lets two Workspaces over one file-content backend select two isolated ledgers (ADR 0294 Scenario 1).

func New

func New() *Ledger

New returns a fresh, empty in-memory ReadLedger.

func (*Ledger) RecordRead

func (l *Ledger) RecordRead(_ context.Context, key string, version tool.FileVersion) error

RecordRead stores a valid version under key. It performs no file-content I/O.

func (*Ledger) RecordedVersion

func (l *Ledger) RecordedVersion(_ context.Context, key string) (tool.FileVersion, bool, error)

RecordedVersion returns the version previously recorded for key. ok is false when key was never recorded; err is always nil (an in-memory map has no unavailable/corrupt state to report).

Jump to

Keyboard shortcuts

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