Types
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 Location) Exists() bool
Exists reports whether the run directory the record names exists.
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 struct {
// Has unexported fields.
}
Registry is the run index under one master directory.
func Default() (Registry, error)
Default returns the registry under the resolved master directory; see
state.ResolveMasterDir.
func Open(masterDir string) Registry
Open returns the registry under masterDir.
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 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 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 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 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 Registry) Unregister(runID string) error
Unregister removes the record for runID if there is one.