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 ¶
- Variables
- func Add(dir, root string) (added bool, err error)
- func File(dir string) string
- func List(dir string) ([]string, error)
- func StoreDir(path string) (string, error)
- type NotServedError
- type Set
- func (s *Set) Close(ctx context.Context) error
- func (s *Set) Get(ctx context.Context, path string) (*state.State, error)
- func (s *Set) OpenRegistered(ctx context.Context) []error
- func (s *Set) Opening() bool
- func (s *Set) Paths() []string
- func (s *Set) Pending() (intents int, next time.Time, ok bool)
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = errors.New("the engine's repos are closed")
ErrClosed is returned by a Set that has been closed.
Functions ¶
func Add ¶
Add registers the absolute path root. It reports false when root was already registered. Entries are only ever appended.
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 ¶
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 ¶
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 ¶
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 ¶
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.