Documentation
¶
Overview ¶
Package workspace defines workspace values and detached storage locations.
Index ¶
- Constants
- Variables
- func FindWorkspaceByID(root string, id ID) (string, error)
- func ManifestPath(repositoryRoot string) (string, error)
- func RepositoryPath(storageRoot string, id ID) (string, error)
- func StorageRoot() (string, error)
- func UpdateRegistry(root string, update func(*Registry) error) (err error)
- func WriteManifest(repositoryRoot string, manifest Manifest) (err error)
- type ID
- type Manifest
- type Name
- type Registry
- type Workspace
Constants ¶
const (
CurrentManifestVersion = 1
)
Variables ¶
var ( ErrInvalidManifest = errors.New("workspace manifest is invalid") ErrManifestNotFound = errors.New("workspace manifest was not found") ErrManifestConflict = errors.New("workspace manifest binds a different workspace") ErrInvalidRepositoryID = errors.New("repository identity is invalid") )
var ( ErrInvalidName = errors.New("workspace name is invalid") // ErrInvalidID reports a workspace identity that does not match the // manifest format. ErrInvalidID = errors.New("workspace identity is invalid") )
var ( ErrWorkspaceNotRegistered = errors.New("workspace is not registered") ErrWorkspaceExists = errors.New("workspace already exists") ErrInvalidRegistry = errors.New("workspace registry is invalid") )
var ( // ErrInvalidStorageRoot reports a configured XDG data root that is not an // absolute filesystem path. ErrInvalidStorageRoot = errors.New("workspace storage root is invalid") // provide the home directory needed for its default storage location. ErrStorageRootUnavailable = errors.New("workspace storage root is unavailable") )
Functions ¶
func FindWorkspaceByID ¶ added in v0.0.8
FindWorkspaceByID resolves a manifest's immutable workspace identity to its detached repository state.
func ManifestPath ¶ added in v0.0.8
ManifestPath returns the checkout-owned manifest path.
func RepositoryPath ¶
RepositoryPath returns the deterministic detached repository directory for id below storageRoot. It performs no filesystem access or symlink resolution.
func StorageRoot ¶
StorageRoot returns Spool's platform-appropriate detached storage root.
XDG_DATA_HOME, when configured, takes precedence on every platform. Unix defaults to the XDG data location; Windows uses its conventional per-user application-data location when no XDG override is present.
func UpdateRegistry ¶
UpdateRegistry serializes catalog provisioning updates.
func WriteManifest ¶ added in v0.0.8
WriteManifest atomically writes a validated checkout manifest. Existing local repository control state is never overwritten.
Types ¶
type Manifest ¶ added in v0.0.8
type Manifest struct {
FormatVersion int `toml:"format_version"`
RepositoryID string `toml:"repository_id"`
WorkspaceID ID `toml:"workspace_id"`
}
Manifest declares the portable workspace binding for a checkout.
func DiscoverManifest ¶ added in v0.0.8
func DiscoverManifest(workingDirectory string) (repositoryRoot string, manifest Manifest, found bool, err error)
DiscoverManifest searches workingDirectory and its ancestors for a workspace manifest. A local Spool repository config without workspace_id is ignored.
type Name ¶
type Name string
Name is the user-selected name used only for explicit workspace provisioning.