I8: the take-in fed by the forge bridge's messages goes with B1's forgemsg: the FORGE consumer and its handlers, the group end, the pending state with its keys, claims, dry take-in and hand tools (indexer_pending, indexer_take_in_pending, indexer_drop_pending, indexer_take_in_merge, kept again for the held take-in in I5), the catch-up by comparison (kickBehind, TakeInBehind, sayUntaken, takeInHeads, kickCatchUp, CatchUp, merge-untaken), the source numbering in memory (nextSource), the source verb's follow and Src stamping on a source answer, the bridge's merged message call, the pull request candidates written from pull and open messages, the checker's previews and verdict hearing. A repository's trees at a commit are the internal whole (wholeAt), which ApplyMessage takes in; the dry indexer stays for a run on request's candidate. The manifest drops the consumes of forge.**, the checker's verdict and version-delivered, the reads of the checker's previews and the invokes of open-pulls, bridge_merged_message and mesh-delivery.source. RoomAgain says room when a take-in is held on a full store (heldFull, I5 holds it). H-A-82: the fill of delivered versions into the edges goes: HearVersionDelivered, the delivered.<module> key, the first fill's kinds 2, 4 and 6 from the placement and the stream running, and outdated's kinds 2, 4 and 6; their entries read not yet delivered. The tests of the removed paths go (index_test's candidate groups, source_test, branch_take_in_test, previews_test, candidate_manifests_test, the FORGE handle tests); the versions tests now hold kinds 2, 4 and 6 as declarations. The integration tests still drive FORGE and are rewritten in I10. Builds: design 47 H §743, §744, §764 (the indexer); H-A-48, H-A-82 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
65 lines
2.3 KiB
Go
65 lines
2.3 KiB
Go
package index
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"slices"
|
|
|
|
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
|
|
"git.novox.be/novox/mesh-sdk/go/keys"
|
|
)
|
|
|
|
// ErrAskClosed is what a kept call answers when its ask was closed while it was made again (design 47 G §351, §460, A-190):
|
|
// what the ask served no longer stands, so the call stopped and is not said unanswered.
|
|
var ErrAskClosed = errors.New("the ask is closed: what it served no longer stands")
|
|
|
|
// SeedEntryHeld says the newest trunk revision still holds the entry of module at the fingerprint fp, the candidate the
|
|
// seed asks steps for (A-190).
|
|
func (ix *Indexer) SeedEntryHeld(ctx context.Context, module, fp string) (bool, error) {
|
|
if ctx.Err() != nil || ix.Revisions == nil {
|
|
return false, ctx.Err()
|
|
}
|
|
_, entries, found, err := readNewestOf(ctx, ix.Revisions, TrunkBranch)
|
|
if err != nil || !found {
|
|
return false, err
|
|
}
|
|
return slices.ContainsFunc(entries, func(e meshcatalog.CatalogEntry) bool { return e.Module == module && e.Fp == fp }), nil
|
|
}
|
|
|
|
// ModuleInNewestView says module is among the entries of the newest trunk revision, the view the versions are filled for (A-190).
|
|
func (ix *Indexer) ModuleInNewestView(ctx context.Context, module string) (bool, error) {
|
|
if ctx.Err() != nil || ix.Revisions == nil {
|
|
return false, ctx.Err()
|
|
}
|
|
_, entries, found, err := readNewestOf(ctx, ix.Revisions, TrunkBranch)
|
|
if err != nil || !found {
|
|
return false, err
|
|
}
|
|
return slices.ContainsFunc(entries, func(e meshcatalog.CatalogEntry) bool { return e.Module == module }), nil
|
|
}
|
|
|
|
// BranchWatched says branch (as the source's key names it, escaped; empty asks the list of every branch) is watched: the
|
|
// trunk always, another branch while a registration names it (A-190). With no registry, every branch is.
|
|
func (ix *Indexer) BranchWatched(ctx context.Context, branch string) (bool, error) {
|
|
if ctx.Err() != nil {
|
|
return false, nil
|
|
}
|
|
if isTrunkBranch(branch) || ix.Registry == nil || ix.Registry.Registrations == nil {
|
|
return true, nil
|
|
}
|
|
name, err := keys.UnescapeName(branch)
|
|
if err != nil {
|
|
return false, nil
|
|
}
|
|
regs, err := ix.Registry.RegistrationsAnswer(ctx, meshcatalog.RegistrationsInput{})
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
for _, r := range regs.Registrations {
|
|
if slices.Contains(r.Branches, name) {
|
|
return true, nil
|
|
}
|
|
}
|
|
return false, nil
|
|
}
|