Documentation
¶
Overview ¶
Package index owns the branch→index mapping of a project's worktrees. It feeds the port formula and the compose project name, so an index must never change once a stack exists: allocated once, recorded, recovered from docker.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoIndex = errors.New("no recorded index")
ErrNoIndex means the branch has no recorded index and no docker trace: as far as stacks are concerned, this worktree never started one.
Functions ¶
func MatchBranch ¶
MatchBranch finds the label belonging to this repo and branch among compose project labels. It extracts the candidate integer then rebuilds the canonical name, so stack.ProjectName stays the single naming authority.
Types ¶
type Mode ¶
type Mode int
Mode says whether a resolution may invent a new index. Commands that bring a stack up may; commands that address an existing stack (stop, remove, exec) must not, or they would "find" a stack that never existed.
type Resolver ¶
type Resolver struct {
ConfigPath string
Runner execx.Runner
Name string // project name in the registry
RepoName string // filepath.Base of the project directory
Out io.Writer
// Conflicts says why index n must not be handed out, or "" when it may: with
// a stride of 1, services one port apart collide on neighbouring indices.
// It runs under the registry lock, given the registry that lock holds.
Conflicts func(c *config.Config, n int) string
}