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 ¶
- Variables
- func Locate(issuesRoot, item string) (run, path string, err error)
- func LocateAdmission(issuesRoot, id string) (run, path string, err error)
- func Paths(issuesRoot, item string) ([]string, error)
- func RefuseSymlinkedDir(dir string) error
- func ResolveOccasion(repoRoot, id string, families ...Family) (string, error)
- type Family
Constants ¶
This section is empty.
Variables ¶
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 ¶
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
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 ¶
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 ¶
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 ¶
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.