basedirregistry

package
v0.1.29 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 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 basedirregistry indexes state directories for discovery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Discover

func Discover(masterDir string) (baseDirs []string, fromRuns bool, err error)

Discover lists the basedirs registered under masterDir without writing. A master directory from before the basedir registry existed has only run records; their basedirs are listed instead and fromRuns is set, so that a caller allowed to write can register them.

func Find

func Find(masterDir, ref string) (string, error)

Find returns the basedir registered under masterDir whose Ref is ref, as Discover lists them.

func Ref

func Ref(baseDir string) string

Ref returns a short, stable reference to an absolute baseDir: the key of its registry record. It names a basedir without revealing its path.

Types

type Registry

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

Registry stores one discovery record per basedir under a master directory.

func Default

func Default() (Registry, error)

Default returns the registry under the resolved master directory.

func Open

func Open(masterDir string) Registry

Open returns the basedir registry under masterDir.

func (Registry) BaseDirs

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

BaseDirs lists registered basedirs. Missing or malformed records are skipped.

func (Registry) Missing

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

Missing returns registered basedirs whose directories no longer exist.

func (Registry) Register

func (registry Registry) Register(baseDir string) error

Register adds baseDir to the discovery index. Registration is idempotent.

func (Registry) Remove

func (registry Registry) Remove(baseDir string) (bool, error)

Remove unregisters baseDir if its record still refers to that exact path.

Jump to

Keyboard shortcuts

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