Reach an old objects entry by the store grants creates for it, not by a membership field (A-380)

Builds: design 47 G A-380 (corrects A-379)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-13 23:19:04 +01:00
parent faa1064214
commit 7a6174bb3e
3 changed files with 15 additions and 11 deletions
+13 -5
View File
@@ -62,18 +62,22 @@ func (c *Conn) Bindings(module string) []membership.BusBinding {
// A-16, A-27).
func (c *Conn) JetStream() (jetstream.JetStream, error) { return jetstream.New(c.nc) }
// objectBucketOf is the bus name of the module's object store of a local name: its binding's when it has one, else the
// store its membership's old `objects` section names under the name grants created for it, `<module>_<name>` (design 47 G
// lead answers A-379); a name neither names is refused as the binding refuses it.
// objectBucketOf is the bus name of the module's object store of a local name: its binding's when it has one, else, for a
// name no binding of any type holds, the store grants creates for a module's old `objects` entry, `<module>_<name>`
// (catalogue.ObjectsBucket; design 47 G lead answers A-380): the bus's rights decide whether it is reached. A name bound
// with another storage type is refused as the binding refuses it.
func (c *Conn) objectBucketOf(module, local string) (membership.BusBinding, error) {
b, err := c.Binding(module, local, catalogue.StorageObjectStore)
if err == nil {
return b, nil
}
if m := c.Membership(module); m != nil {
if store := strings.TrimPrefix(m.Objects[local], "OBJ_"); store != "" {
return membership.BusBinding{Local: local, Storage: catalogue.StorageObjectStore, ObjectStore: store}, nil
for _, held := range m.Bindings {
if held.Local == local {
return b, err
}
}
return membership.BusBinding{Local: local, Storage: catalogue.StorageObjectStore, ObjectStore: catalogue.ObjectsBucket(module, local)}, nil
}
return b, err
}
@@ -89,6 +93,10 @@ func (c *Conn) objectStore(ctx context.Context, module, local string) (jetstream
}
obs, err := js.ObjectStore(ctx, b.ObjectStore)
if errors.Is(err, jetstream.ErrBucketNotFound) || errors.Is(err, jetstream.ErrStreamNotFound) {
if b.Template == "" {
return nil, b, fmt.Errorf("%s was bound no object-store called %q, and the store %s grants creates for an old `objects` entry of that name is not on the bus",
module, local, b.ObjectStore)
}
return nil, b, fmt.Errorf("%s's objects %q are bound and their store %s is not on the bus", module, local, b.ObjectStore)
}
return obs, b, err