indexer: hear the kept seat events on their own streams
The two package-published of mesh-delivery-pipeline 0.1.6 sit on SEAT_mesh-builds_package-published, where the indexer's program durable novox_mesh-delivery-indexer holds them pending and was never pulled: the program bound only its durable on EVENTS, and a kept seat event is never there. So no version was released. The same holds for toolchain-agreed (2 pending) and node-build-go's step-ended (10 pending). The program now binds, once its EVENTS durable is bound, its durable on each kept stream whose event it handles, as the builder does. Builds: design 47 G A-397, §349
This commit is contained in:
@@ -755,7 +755,7 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
|
||||
logger.Printf("the open changes of the registrations are not all read again at the start: %v", err)
|
||||
}
|
||||
_ = notHeard.Bind(process.EventsStream, "no package's series moves, no warrant for a change of a registration is heard, no node's manifest-reads-changed and no assignments view is heard until the indexer starts again", func() error {
|
||||
if err := hub.Start(ctx, js, cred); err != nil {
|
||||
if err := startHearing(ctx, hub, js, cred); err != nil {
|
||||
stopped = cmp.Or(stopped, err)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -180,6 +180,14 @@ func TestAMessageIsIndexedAndAcked(t *testing.T) { // 1238/AC2 (unit part)
|
||||
}
|
||||
}
|
||||
})
|
||||
// Design 47 G A-397: the program hears its kept seat events (package-published among them) on their own streams once its
|
||||
// durable on EVENTS is bound, never when that fails.
|
||||
for _, startErr := range []error{nil, errors.New("not composed yet")} {
|
||||
h := &startedHub{startErr: startErr}
|
||||
if err := startHearing(context.Background(), h, nil, process.Account{}); !errors.Is(err, startErr) || h.kept != (startErr == nil) {
|
||||
t.Errorf("start error %v: answered %v, kept streams bound %v", startErr, err, h.kept)
|
||||
}
|
||||
}
|
||||
// Design 47 G A-420: a package-published that cannot be kept is left for the bus, and on its last delivery said given up,
|
||||
// naming its subject, the artifact and version and the last refusal; before it, nothing more is said.
|
||||
for _, n := range []uint64{4, EventDeliveries} {
|
||||
@@ -297,3 +305,17 @@ func TestTheIndexerTakesAPushedMessage(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// startedHub records which of an event hub's starts were asked.
|
||||
type startedHub struct {
|
||||
startErr error
|
||||
kept bool
|
||||
}
|
||||
|
||||
func (h *startedHub) Start(context.Context, jetstream.JetStream, process.Account) error {
|
||||
return h.startErr
|
||||
}
|
||||
func (h *startedHub) StartKept(context.Context, jetstream.JetStream, process.Account) int {
|
||||
h.kept = true
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -48,6 +48,24 @@ func sayVersionReleased(conn *nats.Conn, cred process.Account) func(context.Cont
|
||||
}
|
||||
}
|
||||
|
||||
// hubStarter is the event hub as startHearing starts it.
|
||||
type hubStarter interface {
|
||||
Start(ctx context.Context, js jetstream.JetStream, cred process.Account) error
|
||||
StartKept(ctx context.Context, js jetstream.JetStream, cred process.Account) int
|
||||
}
|
||||
|
||||
// startHearing binds the indexer's durable on the shared events stream and then, beside it, its durable on each kept seat
|
||||
// event's own stream (SEAT_<seat>_<event>) whose event it handles: package-published, toolchain-agreed and the build seats'
|
||||
// step-ended are never on EVENTS, and its tool runner reads only its own twin there, so the program hears them only so
|
||||
// (design 47 G A-397; mesh-sdk process.EventHub.StartKept).
|
||||
func startHearing(ctx context.Context, hub hubStarter, js jetstream.JetStream, cred process.Account) error {
|
||||
if err := hub.Start(ctx, js, cred); err != nil {
|
||||
return err
|
||||
}
|
||||
hub.StartKept(ctx, js, cred)
|
||||
return nil
|
||||
}
|
||||
|
||||
// EventDeliveries is how many times the bus gives a message of the indexer's events consumer: the MaxDeliver the grants part
|
||||
// composes a module's durable with (mesh-grants buscompose).
|
||||
const EventDeliveries = 5
|
||||
|
||||
Reference in New Issue
Block a user