repos

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 14 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 repos keeps the repos registered on this machine, the ones the engine serves, one absolute path per line in the repos file of Physa's settings directory, and opens their state.

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("the engine's repos are closed")

ErrClosed is returned by a Set that has been closed.

Functions

func Add

func Add(dir, root string) (added bool, err error)

Add registers the absolute path root. It reports false when root was already registered. Entries are only ever appended.

func File

func File(dir string) string

File returns the repos file inside the settings directory dir.

func List

func List(dir string) ([]string, error)

List returns the registered repo paths in file order. A missing file is an empty list. Blank lines and duplicates are ignored.

func StoreDir

func StoreDir(path string) (string, error)

StoreDir returns the store directory of the repo at path. A path that is not a repo is an error naming it.

Types

type NotServedError

type NotServedError struct{ Err error }

NotServedError is Get's error for a path the engine cannot serve: not absolute, not a repo, or a repo of another shape. It names the path.

func (*NotServedError) Error

func (e *NotServedError) Error() string

func (*NotServedError) Unwrap

func (e *NotServedError) Unwrap() error

type Set

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

Set holds the open state of each registered repo, keyed by store directory, so the paths of one repo (its subdirectories and its worktrees) share one store and one state.

func NewSet

func NewSet(dir string, o state.Options) *Set

NewSet returns a Set for the settings directory dir. It opens nothing; each state is opened with o and its own StoreDir.

func (*Set) Close

func (s *Set) Close(ctx context.Context) error

Close refuses further Gets, waits for the opens in flight, then closes every state and the store of each state that closed. A store whose state did not close in time is left open, and the error names it.

func (*Set) Get

func (s *Set) Get(ctx context.Context, path string) (*state.State, error)

Get returns the state of the repo at the absolute path, registering the repo's root when it is new and opening its store and state when they are not open yet. Concurrent calls for one repo open it once.

func (*Set) OpenRegistered

func (s *Set) OpenRegistered(ctx context.Context) []error

OpenRegistered opens every registered repo, one at a time, each bounded by ctx. An entry that is no longer a repo, or whose store fails to open, is skipped with an error naming it, and stays in the file.

func (*Set) Opening

func (s *Set) Opening() bool

Opening reports whether OpenRegistered is running.

func (*Set) Paths

func (s *Set) Paths() []string

Paths returns the root of each open repo, sorted: one per open store.

func (*Set) Pending

func (s *Set) Pending() (intents int, next time.Time, ok bool)

Pending sums the open states' pending intents and finds the earliest of their next timers; ok is false when no state has a timer.

Jump to

Keyboard shortcuts

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