Register a new module from the builder's first done key and ask no first build; its condition reads the key and names a manifest word this controller does not read (issue 1851, A5a, A5b)

This commit is contained in:
2026-10-22 19:05:04 +02:00
parent d984f0a55d
commit ea3c8ad7f6
19 changed files with 608 additions and 1011 deletions
+33
View File
@@ -158,6 +158,39 @@ func (r Reader) ModuleAt(ctx context.Context, module, commit string) (delivery.M
return pickAt(module, commit, values)
}
// Modules is every module the indexer holds a trunk value of, by module: the value it holds now. A value that does not
// decode is left out and said in unread.
func (r Reader) Modules(ctx context.Context) (values map[string]delivery.Module, unread map[string]error, err error) {
kv, err := r.bucket(ctx, delivery.ModulesBucket)
if err != nil || kv == nil {
return nil, nil, err
}
keys, err := kv.Keys(ctx)
if errors.Is(err, jetstream.ErrNoKeysFound) {
return nil, nil, nil
}
if err != nil {
return nil, nil, fmt.Errorf("listing the indexer's modules: %w", err)
}
values, unread = map[string]delivery.Module{}, map[string]error{}
for _, key := range keys {
e, err := kv.Get(ctx, key)
if errors.Is(err, jetstream.ErrKeyNotFound) {
continue
}
if err != nil {
return nil, nil, fmt.Errorf("the indexer's value of %s: %w", key, err)
}
m, err := delivery.DecodeModule(e.Value())
if err != nil {
unread[key] = err
continue
}
values[key] = m
}
return values, unread, nil
}
// pickAt is, of a key's values oldest first, the newest whose commit is commit (any, with commit empty); values that
// do not decode are passed over, and one of them is said when nothing else is found.
func pickAt(module, commit string, values [][]byte) (delivery.Module, error) {