walkrun

package
v0.0.43 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: Apache-2.0 Imports: 19 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 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

View Source
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

func Text

func Text(w io.Writer, r Result) error

Text writes what the walk did in plain words: the totals, the names numbered, each area with its capabilities or its parts, and the model, and how many areas an earlier walk kept when it kept any. It names no session and no file.

Types

type AreaResult

type AreaResult struct {
	Name         string   `json:"name"`
	Parent       string   `json:"parent,omitempty"`
	Capabilities []string `json:"capabilities"`
	Owned        int      `json:"owned"`
	Shared       int      `json:"shared"`
	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"`
	Shared       int            `json:"shared"`
	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

func Run(ctx context.Context, st Store, s Session) (Result, error)

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.

func (Result) KeptLine

func (r Result) KeptLine() string

KeptLine says what a stopped walk kept and what physa init --walk does next, for the caller to print when the cap or an interrupt stopped it.

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.

func (*Stuck) Error

func (e *Stuck) Error() string

Jump to

Keyboard shortcuts

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