I6 (2c): the indexer keeps the seat list at its start too
Once the seat definitions' state is bound at the start, the indexer keeps the seat list in seat-lists, so seat-list answers from the first delivery and never refuses "not kept yet" for want of a trunk definition's move. Builds: design 47 H2 §814, §820; H-A-447
This commit is contained in:
@@ -329,6 +329,7 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
|
||||
}
|
||||
}, seatLists)
|
||||
readWhenBound(seatReader, seatDefs, marks)
|
||||
keepSeatListAtStart(ctx, seatDefs, seatBus.defs, seatLists, logger.Printf)
|
||||
var fillFollow atomic.Pointer[versionsFill]
|
||||
// Kept while named (design 47 G §675): the want and the running build that name a fingerprint, heard below.
|
||||
named := index.NewNamed(awaitedStore{b: process.AwaitBucket(ctx, js, conn, index.Bucket(cred.Module, index.NamedState), "no entry is kept for a want or a running build that names it", logger.Printf)}, logger.Printf)
|
||||
|
||||
@@ -147,5 +147,16 @@ func readWhenBound(part *seatlist.Part, states ...bucket) {
|
||||
}
|
||||
}
|
||||
|
||||
// keepSeatListAtStart keeps the seat list in lists once the seat definitions' state is bound at the indexer's start, so the
|
||||
// verb seat-list answers from the first delivery and not only after a trunk definition's move (design 47 H2 §814; H-A-447).
|
||||
// A list that cannot be kept is said in logf.
|
||||
func keepSeatListAtStart(ctx context.Context, state bucket, defs views.Source, lists index.SeatLists, logf func(string, ...any)) {
|
||||
state.Ready(func(jetstream.KeyValue) {
|
||||
if _, err := index.KeepSeatList(ctx, defs, lists, logf); err != nil {
|
||||
logf("the seat list is not kept in %s at the start: %v", index.SeatListsObjects, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// toolPrefix is the prefix of the indexer's tools, its manifest's slug.
|
||||
const toolPrefix = "indexer"
|
||||
|
||||
@@ -53,7 +53,7 @@ func TestTheSeatListIsReadAgainWhenItsStatesAreBound(t *testing.T) {
|
||||
var unkept []string
|
||||
logf := func(f string, a ...any) {
|
||||
t.Logf(f, a...)
|
||||
if strings.HasPrefix(f, "the seat list is not kept") {
|
||||
if strings.HasPrefix(f, "the seat list is not kept in %s after") {
|
||||
mu.Lock()
|
||||
unkept = append(unkept, fmt.Sprintf(f, a...))
|
||||
mu.Unlock()
|
||||
@@ -100,5 +100,15 @@ func TestTheSeatListIsReadAgainWhenItsStatesAreBound(t *testing.T) {
|
||||
if len(unkept) != 1 || !strings.Contains(unkept[0], "holds no trunk definition") {
|
||||
t.Errorf("the moves kept the seat list as %q, want one try, for the trunk's", unkept)
|
||||
}
|
||||
// H-A-447: and once the state is bound at the start, with no move.
|
||||
started, atStart := &awaitedFake{}, ""
|
||||
keepSeatListAtStart(context.Background(), started, src, &busObjects{}, func(f string, a ...any) { atStart = fmt.Sprintf(f, a...) })
|
||||
if atStart != "" || len(started.ready) != 1 {
|
||||
t.Fatalf("the seat list was kept before its state was bound: %q", atStart)
|
||||
}
|
||||
started.ready[0](nil)
|
||||
if !strings.Contains(atStart, "at the start") || !strings.Contains(atStart, "holds no trunk definition") {
|
||||
t.Errorf("the start kept the seat list as %q, want one try", atStart)
|
||||
}
|
||||
var _ seatlist.Bus = bus
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ import (
|
||||
|
||||
// The seat list as one object (design 47 H2 §814, §820; H-A-441): the trunk's seat definitions, resolved with their
|
||||
// includes, as one JSON array in composer.Request.Seats' form sorted by seat, kept in the indexer's objects seat-lists
|
||||
// under its digest (the sha256 of those bytes), written at each trunk seat-definition-changed or -removed; every object
|
||||
// under its digest (the sha256 of those bytes), written at the indexer's start (H-A-447) and at each trunk
|
||||
// seat-definition-changed or -removed; every object
|
||||
// but the newest two is deleted at each new list. The seat mesh-catalog's verb seat-list hands its digest, size and bytes, and
|
||||
// a validate run's asker fills its request's seats from them, so every run of one seat list judges the same bytes.
|
||||
|
||||
@@ -145,7 +146,7 @@ func SeatListVerb(defs views.Source, o SeatLists, line buscalls.ChunkLine, withi
|
||||
}
|
||||
body, err := o.Get(ctx, digest)
|
||||
if errors.Is(err, ErrNoObject) {
|
||||
return nil, fmt.Errorf("the seat list %s is not kept in %s yet: it is written at the trunk's next seat-definition change", digest, SeatListsObjects)
|
||||
return nil, fmt.Errorf("the seat list %s is not kept in %s yet: it is written at the indexer's start and at each trunk seat-definition move", digest, SeatListsObjects)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("the seat list %s cannot be read from %s: %w", digest, SeatListsObjects, err)
|
||||
|
||||
Reference in New Issue
Block a user