The pending wait, the abandon, the merge by hand with its repository and sequence, and their ask builders go; an ask naming only one of them is refused as naming no hand act. Builds: design 47 H §744, §764 (the indexer); H-A-48 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
77 lines
3.9 KiB
Go
77 lines
3.9 KiB
Go
package index
|
|
|
|
import (
|
|
"encoding/json"
|
|
"errors"
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
// The indexer's hand acts (novox/hq issue 1945; the instruction "tools are how a module is spoken to"): the tools bundle
|
|
// serves them through the tool runner; the indexer's process serves no request subject (ADR 0437 §4), so a tool writes
|
|
// an ask into the indexer's state takeins, which the indexer watches and answers there, as the builder answers
|
|
// builder_ask_again. No tool takes a head in by hand: the gate's gate_head_take is the one hand take of a head (design 47
|
|
// H §742, H-A-105).
|
|
const (
|
|
// TakeInsState is the indexer's state of hand-act asks: the bucket mesh-delivery-indexer_takeins.
|
|
TakeInsState = "takeins"
|
|
)
|
|
|
|
// TakeInAsk is a value of the takeins state: which hand act a person asked, why, who and when, and, once the indexer read
|
|
// it, its answer.
|
|
type TakeInAsk struct {
|
|
V int `json:"v"`
|
|
Module string `json:"module,omitempty"`
|
|
Why string `json:"why,omitempty"`
|
|
// SeatDefinitions asks a contracts module's trunk seat definitions to be read again now (indexer_seat_definitions_again,
|
|
// DLV-I19).
|
|
SeatDefinitions bool `json:"seat-definitions,omitempty"`
|
|
// Fingerprints asks the fingerprints of Module ("all": every module) to be computed again now, from the published
|
|
// packages as they are read (indexer_fingerprints_again, fingerprints.go).
|
|
Fingerprints bool `json:"fingerprints,omitempty"`
|
|
// Recompute asks the catalog graph to be computed again now and compared with the newest kept revision (indexer_recompute).
|
|
Recompute bool `json:"recompute,omitempty"`
|
|
// CandidateGroup and CandidateHeads, with Drop, ask that candidate's catalog half to be dropped (indexer_drop_candidate_graph).
|
|
CandidateGroup string `json:"candidate-group,omitempty"`
|
|
CandidateHeads string `json:"candidate-heads,omitempty"`
|
|
Drop bool `json:"drop,omitempty"`
|
|
// NamedFingerprint and NamedMember, with Drop, ask one member to be removed from that fingerprint's set of the state named
|
|
// (indexer_named_drop, named.go, design 47 G §675).
|
|
NamedFingerprint string `json:"named-fingerprint,omitempty"`
|
|
// PinDrop asks one pin of the state pins, by its key, to be dropped (indexer_pin_drop, design 47 H §765).
|
|
PinDrop string `json:"pin-drop,omitempty"`
|
|
// Held names the watched branch whose held source-moved is taken in again now (indexer_take_in_pending) or, with Skip and
|
|
// HeldSource, ended unwritten (indexer_take_in_skip; design 47 H §744).
|
|
Held string `json:"held,omitempty"`
|
|
HeldSource int64 `json:"held-source,omitempty"`
|
|
Skip bool `json:"skip,omitempty"`
|
|
NamedMember string `json:"named-member,omitempty"`
|
|
// RunDrop asks one run on request, by its group run-<id>, to be dropped with its candidate (indexer_run_drop, runs_tools.go, A-194).
|
|
RunDrop string `json:"run-drop,omitempty"`
|
|
// Registry asks one of the registrations' acts (registrations.go): a trusted change of one, the verb registrations,
|
|
// indexer_proposal_drop or indexer_seed_again (design 47 G §3, §4, §8, §667).
|
|
Registry *RegistryAct `json:"registry,omitempty"`
|
|
By string `json:"by,omitempty"`
|
|
At time.Time `json:"at"`
|
|
Result *TakenIn `json:"result,omitempty"`
|
|
Answered time.Time `json:"answered,omitzero"`
|
|
}
|
|
|
|
// Done says the ask is answered.
|
|
func (a TakeInAsk) Done() bool { return !a.Answered.IsZero() && a.Result != nil }
|
|
|
|
// DecodeTakeIn reads a takeins value.
|
|
func DecodeTakeIn(data []byte) (TakeInAsk, error) {
|
|
var a TakeInAsk
|
|
if err := json.Unmarshal(data, &a); err != nil {
|
|
return a, err
|
|
}
|
|
if a.V != 1 {
|
|
return a, fmt.Errorf("a takeins value of version %d, not 1", a.V)
|
|
}
|
|
if a.Module == "" && !a.Fingerprints && !a.Recompute && a.CandidateGroup == "" && a.NamedFingerprint == "" && a.PinDrop == "" && a.Held == "" && a.RunDrop == "" && a.Registry == nil {
|
|
return a, errors.New("a takeins value naming no hand act the indexer serves")
|
|
}
|
|
return a, nil
|
|
}
|