runregistry

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 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 runregistry indexes where each run lives.

Run IDs do not encode a location, so the master directory keeps one record per run, <masterdir>/runs/<run-id>.json, naming the run's base directory and project. The registry is only an index: run files remain authoritative, and an entry whose run directory is gone is stale rather than a reason to fall back to another run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

type Location struct {
	BaseDir     string `json:"base_dir"`
	ProjectName string `json:"project_name"`
	RunID       string `json:"run_id"`
}

Location is one registry record.

func (Location) Exists

func (location Location) Exists() bool

Exists reports whether the run directory the record names exists.

func (Location) Valid

func (location Location) Valid() bool

Valid reports whether the record is well formed: an absolute base directory and path-safe project and run IDs.

type Registry

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

Registry is the run index under one master directory.

func Default

func Default() (Registry, error)

Default returns the registry under the resolved master directory; see state.ResolveMasterDir.

func Open

func Open(masterDir string) Registry

Open returns the registry under masterDir.

func (Registry) BaseDirs

func (registry Registry) BaseDirs() ([]string, error)

BaseDirs lists the base directories named by readable records, with duplicates. Unreadable records are ignored; discovery is not exhaustive.

func (Registry) Lookup

func (registry Registry) Lookup(runID string) (Location, bool, error)

Lookup returns the record for runID. It reports false when the run is not registered and an error when the record is unreadable or inconsistent.

func (Registry) Orphans

func (registry Registry) Orphans() ([]Location, []string, error)

Orphans lists well-formed records whose run directory is missing, and the paths of malformed records, which are left for manual inspection.

func (Registry) Register

func (registry Registry) Register(location Location) error

Register records location. Registering the same mapping again is a no-op; mapping a registered run ID to another location fails.

func (Registry) RemoveOrphan

func (registry Registry) RemoveOrphan(planned Location) (bool, error)

RemoveOrphan removes planned if its record is unchanged and its run directory is still missing. It reports whether the record was removed.

func (Registry) Unregister

func (registry Registry) Unregister(runID string) error

Unregister removes the record for runID if there is one.

Jump to

Keyboard shortcuts

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