A-376: the bus keeper makes the catalog half's own holder before the first views
Before the catalog half's first views are in (a read refused, or none-yet), the keeper reads the manifest on the trunk of the holder of the seat mesh-catalog from the seat's states modules and manifests (the holder from the seat that places modules) and makes its kept data as any module's, each entry said as ever; every other module waits as A-367 says. Builds: design 47 G A-376 (G-22-lead-answers-2.md) Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -240,7 +240,7 @@ func runKeeper(ctx context.Context, getenv func(string) string, logOut io.Writer
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
k.Catalog, k.Seats, k.Again = follow.view, follow.seats, follow.again
|
||||
k.Catalog, k.Seats, k.Again, k.Holder = follow.view, follow.seats, follow.again, follow.holder
|
||||
// The process answers the seat mesh-broker's snapshot verbs itself (design 47 G §681, A-107), with the caller the bus proved.
|
||||
stopAnswers, err := conn.AnswerSeat(meshbroker.Seat, seatlist.Definition(func() *seatlist.Reader { return follow.seatList }, meshbroker.Seat), snapshotAnswers(k, heldRequest(k.Store), keeperSnapshots(nc, logger.Printf)))
|
||||
if err != nil {
|
||||
@@ -259,11 +259,15 @@ type catalogFollow struct {
|
||||
branches *meshcatalogclient.Branches
|
||||
seatList *seatlist.Reader
|
||||
routes *eventRoutes
|
||||
// call asks a seat verb or a module tool as the keeper's account; holderModules and holderManifests are the seat
|
||||
// mesh-catalog's states `modules` and `manifests` (design 47 G A-376).
|
||||
call seatlist.HolderCaller
|
||||
holderModules, holderManifests *views.Picture
|
||||
}
|
||||
|
||||
// followCatalog wires the branch follower and the seat list, and asks their first views; moved is told of each change.
|
||||
func followCatalog(ctx context.Context, conn *process.Conn, writer views.WireWriter, moved func(), logf func(string, ...any)) (*catalogFollow, error) {
|
||||
f := &catalogFollow{ctx: ctx, routes: &eventRoutes{by: map[string]func(jetstream.Msg){}}}
|
||||
f := &catalogFollow{ctx: ctx, routes: &eventRoutes{by: map[string]func(jetstream.Msg){}}, call: conn.Call}
|
||||
f.reader = &views.ProcessReader{Module: keeper.Module, Call: conn.Call, Logf: logf, Findings: func() views.WireWriter { return writer }}
|
||||
branches, err := meshcatalogclient.FollowBranchesProcess(f.reader, conn.Call)
|
||||
if err != nil {
|
||||
@@ -283,6 +287,18 @@ func followCatalog(ctx context.Context, conn *process.Conn, writer views.WireWri
|
||||
if err != nil {
|
||||
logf("the seat list cannot be followed (%v): a module's sent store waits for it", err)
|
||||
}
|
||||
// The catalog half's own holder (design 47 G A-376): its states `modules` and `manifests`, whichever module holds the seat.
|
||||
holders := func(seat string) []string {
|
||||
if who, err := seatlist.HolderOf(f.call, seat); err == nil {
|
||||
return []string{who}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
for state, into := range map[string]**views.Picture{"modules": &f.holderModules, "manifests": &f.holderManifests} {
|
||||
if *into, err = f.reader.FollowSeat(catalog.Seat, state, holders); err != nil {
|
||||
logf("the seat %s's state %s cannot be followed (%v): its holder's kept data waits for the catalog half", catalog.Seat, state, err)
|
||||
}
|
||||
}
|
||||
f.reader.Ask(ctx, nil)
|
||||
return f, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user