initrecord

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: 4 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 initrecord keeps init's record in .git/physa: the areas a repo was divided into, the one init proposal, the capabilities' recoveries and what each init phase spent. It sits beside the gather the store keeps, in the same database, and a new gather clears it. None of it reaches the map. The tables' schema is the store's: every migration lives in the store's one numbered order.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Areas

type Areas struct {
	GatherAt, At               time.Time
	Model                      string
	Input, CachedInput, Output int64
	Body                       []byte
}

Areas is the one division of a repo into areas the store keeps, with the session that made it and what it used. GatherAt is the run time of the gather it belongs to. Body is the areas and the source split as JSON.

type Consolidated added in v0.0.27

type Consolidated struct {
	WalkAt, At                 time.Time
	Model                      string
	Input, CachedInput, Output int64
	Body                       []byte
}

Consolidated is the one consolidation of the recovered capabilities the store keeps, with the sessions' totals and what they used. WalkAt is the time of the walk it was consolidated from. Body is the record as JSON: what was merged, moved, dropped, lifted and refused, and the consolidated map.

type Place

type Place struct {
	WalkAt, At time.Time
	Body       []byte
}

Place is the one placement of the gathered PRs and changes the store keeps. WalkAt is the time of the walk it was placed from. Body is the placements as JSON: file paths stay here, in init's record.

type Proposal

type Proposal struct {
	GatherAt, At time.Time
	SessionID    string
	Model        string
	Appetite     int64
	Input        int64
	CachedInput  int64
	Output       int64
	Body         []byte
}

Proposal is the one init proposal the store keeps: the capabilities and promise proposed from one gather, with the session that made it and what it used. GatherAt is the run time of the gather it belongs to. Body is the proposal as JSON.

type Recovered

type Recovered struct {
	Capability  string
	ProposalAt  time.Time
	At          time.Time
	Status      string
	File        string
	Terms       string
	Details     []byte
	SessionID   string
	Model       string
	Attempts    int
	Appetite    int64
	Input       int64
	CachedInput int64
	Output      int64
	// KeepEarlier, when true, keeps an earlier stored row of the capability
	// that holds a recovered file (a non-empty File) and does not store this
	// row: a re-run that ends not yet recovered or failed loses nothing.
	KeepEarlier bool
}

Recovered is one capability's recovery the store keeps: the capability text and glossary terms its session wrote, how it ended (Status is stored as given), the session and what it used. ProposalAt is the time of the proposal or the walk it was recovered from. Details is JSON.

type Spent

type Spent struct {
	Phase string
	spend.Count
}

Spent is what one init phase spent, as the run's meter counted it: its raw tokens, and its weighted tokens with their cost estimate.

type Store

type Store struct {
	*store.Store
}

Store is an open store that also keeps init's record. Everything the store keeps, such as the gather, is reached through it as well.

func Of

func Of(st *store.Store) *Store

Of gives st's init record.

func (*Store) AddSpent

func (s *Store) AddSpent(p Spent) error

AddSpent adds p to what its phase has spent so far.

func (*Store) Areas

func (s *Store) Areas() (Areas, bool, error)

Areas returns the stored areas, false when there are none.

func (*Store) Consolidated added in v0.0.27

func (s *Store) Consolidated() (Consolidated, bool, error)

Consolidated returns the stored consolidation, false when there is none.

func (*Store) Place

func (s *Store) Place() (Place, bool, error)

Place returns the stored placement, false when there is none.

func (*Store) Proposed

func (s *Store) Proposed() (Proposal, bool, error)

Proposed returns the stored init proposal, false when there is none.

func (*Store) PutAreas

func (s *Store) PutAreas(a Areas) error

PutAreas replaces the stored areas with a, and clears the walk, placement and consolidation made from the old ones, in one transaction.

func (*Store) PutConsolidated added in v0.0.27

func (s *Store) PutConsolidated(c Consolidated) error

PutConsolidated replaces the stored consolidation with c.

func (*Store) PutPlace

func (s *Store) PutPlace(p Place) error

PutPlace replaces the stored placement with p.

func (*Store) PutProposal

func (s *Store) PutProposal(p Proposal) error

PutProposal replaces the stored init proposal with p. It also deletes the stored recoveries and what proposing and recovering spent, which belong to one proposal.

func (*Store) PutRecoverSeed

func (s *Store) PutRecoverSeed(seed uint64, at time.Time) error

PutRecoverSeed stores the seed of recovery's order, chosen once for a gather, and the time it was chosen. Every uint64 round-trips: the seed is kept as its int64 bit pattern.

func (*Store) PutRecovered

func (s *Store) PutRecovered(rs []Recovered) error

PutRecovered stores rs in one transaction: a capability already stored is replaced, every other stored capability is kept. A row with KeepEarlier leaves an earlier row that holds a file as it is.

func (*Store) PutWalk

func (s *Store) PutWalk(w Walk) error

PutWalk replaces the stored walk with w, and clears the placement and consolidation made from the old one, in one transaction.

func (*Store) RecoverSeed

func (s *Store) RecoverSeed() (seed uint64, ok bool, err error)

RecoverSeed returns the stored seed of recovery's order, false when none is stored for the current gather.

func (*Store) Recovered

func (s *Store) Recovered() ([]Recovered, error)

Recovered returns the stored recoveries ordered by capability.

func (*Store) Spending

func (s *Store) Spending() ([]Spent, error)

Spending returns what each init phase has spent, in run order: discover, areas, walk, propose, recover.

func (*Store) Walk

func (s *Store) Walk() (Walk, bool, error)

Walk returns the stored walk, false when there is none.

type Walk

type Walk struct {
	AreasAt, At                time.Time
	Model                      string
	Input, CachedInput, Output int64
	Body                       []byte
}

Walk is the one walk of the areas the store keeps, with the session totals that made it and what they used. AreasAt is the time of the areas it was walked from. Body is the footprints as JSON: file paths stay here, in init's record, and never reach the map.

Jump to

Keyboard shortcuts

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