readingitem

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 7 Imported by: 0 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 readingitem locates the reading ledger's records by id and resolves an occasion — the record a later write names as what occasioned it.

It is a leaf because the writers that name an occasion live on both sides of an import edge: core/capture (the admission, surprise and disposition paths) imports core/intent, and core/intent (the condition verb) needs the same locator. Neither can import the other's copy, and two copies of a locator is how they come to disagree about whether a symlinked run directory is part of the ledger. So the walk lives here once, and capture keeps its historical names as thin wrappers over it (spc-2609020626046252).

Every walk is shallow and symlink-refusing: a symlinked readings root, run directory or item directory is refused rather than followed, because a caller that writes back to what this returns would otherwise write outside the tree that is supposed to contain it.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknown: no record in the ledger carries the id.
	ErrUnknown = errors.New("unknown reading record")
	// ErrDuplicate: more than one file in the ledger claims the id.
	ErrDuplicate = errors.New("duplicate reading record")
	// ErrPathUnsafe: a directory on the walk is a symlink or not a directory.
	ErrPathUnsafe = errors.New("path unsafe")
)

Functions

func Locate

func Locate(issuesRoot, item string) (run, path string, err error)

Locate finds the one reading record carrying item and the run that holds it. An id is unique to the LEDGER, not to its run, so no run argument is needed.

func LocateAdmission added in v0.11.1

func LocateAdmission(issuesRoot, id string) (run, path string, err error)

LocateAdmission finds the one admission record carrying id across every run bucket under admissions/, and the run it is filed under. An admission is bucketed by RUN, so the walk is Paths' walk over the admission store: every run bucket is checked for a symlink, and the id is unique to the ledger.

func Paths

func Paths(issuesRoot, item string) ([]string, error)

Paths returns every file in the ledger that claims item, across all run directories. Zero matches means the id is free; one is the ordinary case; more is a ledger fault Locate names. An absent readings tree is no matches, not an error: a repository that has commissioned no reading is in a state.

func RefuseSymlinkedDir

func RefuseSymlinkedDir(dir string) error

RefuseSymlinkedDir refuses a path that exists and is not a real directory, under ErrPathUnsafe. An absent path is not a fault: an unpopulated tree is a state. It is the one guard every reading-ledger walk meets, this leaf's and capture's alike, so no two walks can disagree about what the ledger contains.

func ResolveOccasion

func ResolveOccasion(repoRoot, id string, families ...Family) (string, error)

ResolveOccasion resolves id in one of the families the caller admits and returns the path of the record it names. An id outside those families is refused by shape before any path is built. A reading item, a disposition or an admission resolves through the ledger walk above, and a surprise through its flat store, under repoRoot's issue ledger; an intent resolves only in repoRoot's intent store's shipped/ bucket, and a record in any other bucket is refused naming the bucket.

Types

type Family

type Family string

Family is a record family an occasion may name.

const (
	FamilyItem        Family = issueschema.ReadingItemFamily // rdi-N, a reading item
	FamilyDisposition Family = issueschema.DispositionFamily // dsp-N, a disposition
	FamilyAdmission   Family = issueschema.AdmissionFamily   // adm-N, an admission
	FamilySurprise    Family = issueschema.SurpriseFamily    // srp-N, a surprise
	FamilyIntent      Family = "itd"                         // itd-N, a shipped intent
)

The families ResolveOccasion knows. A caller names the ones it admits.

Jump to

Keyboard shortcuts

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