Documentation
¶
Overview ¶
Package walkrun runs init's walk: one read-only session per stored area, which names the area's capabilities with their footprints or splits it once. It keeps every area that ended whole in init's record the moment it is done, walks only the areas not yet kept, and stores the walk from the kept areas when the last one is done. The skill, the check and the record's types are walk's. Nothing reaches the repo or the map.
Index ¶
Constants ¶
const ( // Concurrency is the most sessions running at once. Concurrency = 3 // MaxFixRounds is how often a session is sent back its answer's faults. MaxFixRounds = 2 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AreaResult ¶
type AreaResult struct {
Name string `json:"name"`
Parent string `json:"parent,omitempty"`
Capabilities []string `json:"capabilities"`
Owned int `json:"owned"`
Parts []string `json:"parts"`
}
AreaResult is one area of a Result, or a part of the split area Parent.
type Result ¶
type Result struct {
Areas []AreaResult `json:"areas"`
Capabilities int `json:"capabilities"`
Owned int `json:"owned"`
Unclaimed int `json:"unclaimed"`
FixRounds int `json:"fix_rounds"`
Renamed []walk.Rename `json:"renamed"`
Model string `json:"model"`
Tokens adapter.Tokens `json:"tokens"`
Kept int `json:"kept"`
Done int `json:"done"`
Of int `json:"of"`
}
Result is what the walk ended with: each area in stored order, its parts after it, and the totals, over the areas kept and this run's sessions. Unclaimed is 0 when the walk was stored. Of the Of stored areas, Kept were kept by an earlier walk and Done are kept now.
func Run ¶
Run is init's walk: one read-only session per stored area not yet kept, at most Concurrency at once, names the area's capabilities with their footprints and its shared files, or splits it once into parts walked the same way. Each area that ends whole is kept in init's record the moment it is done. When every stored area is kept, the walk is stored from the kept areas, in stored order, which clears them. Otherwise no walk is stored and the error is the cancelled ctx's, a *Stuck naming each area that failed, or one wrapping adapter.ErrCapped. Nothing reaches the repo or the map.
type Session ¶
type Session struct {
Agent func() (adapter.Adapter, error)
Root string
Progress io.Writer
Now func() time.Time
}
Session is the agent, the root its sessions read, progress and the clock.
type Store ¶
type Store interface {
Areas(ctx context.Context) (initrecord.Areas, bool, error)
PutWalk(context.Context, initrecord.Walk) error
WalkAreas(ctx context.Context) ([]initrecord.WalkArea, error)
PutWalkArea(context.Context, initrecord.WalkArea) error
}
Store is init's record as the walk uses it.
type Stuck ¶
type Stuck struct {
// Reasons holds each failed area or part with why, in stored order.
Reasons []string
// Areas is how many stored areas did not end whole for those reasons; Done
// of the Of stored areas are kept.
Areas, Done, Of int
}
Stuck is the error of a walk in which areas failed for a reason of their own: an answer still not whole after the fix rounds, an unreadable answer, an agent failure. An area the cap refused is not among them.