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 ¶
- type Location
- type Registry
- func (registry Registry) BaseDirs() ([]string, error)
- func (registry Registry) Lookup(runID string) (Location, bool, error)
- func (registry Registry) Orphans() ([]Location, []string, error)
- func (registry Registry) Register(location Location) error
- func (registry Registry) RemoveOrphan(planned Location) (bool, error)
- func (registry Registry) Unregister(runID string) error
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.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is the run index under one master directory.
func Default ¶
Default returns the registry under the resolved master directory; see state.ResolveMasterDir.
func (Registry) BaseDirs ¶
BaseDirs lists the base directories named by readable records, with duplicates. Unreadable records are ignored; discovery is not exhaustive.
func (Registry) Lookup ¶
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 ¶
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 ¶
Register records location. Registering the same mapping again is a no-op; mapping a registered run ID to another location fails.
func (Registry) RemoveOrphan ¶
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 ¶
Unregister removes the record for runID if there is one.