Reach a module's old objects section by its membership when no binding names it (A-379)

Builds: design 47 G A-379

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-13 23:17:29 +01:00
parent a96df478d4
commit 27a45d414d
3 changed files with 32 additions and 2 deletions
+18 -2
View File
@@ -62,8 +62,24 @@ func (c *Conn) Bindings(module string) []membership.BusBinding {
// A-16, A-27).
func (c *Conn) JetStream() (jetstream.JetStream, error) { return jetstream.New(c.nc) }
func (c *Conn) objectStore(ctx context.Context, module, local string) (jetstream.ObjectStore, membership.BusBinding, error) {
// 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.
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
}
}
return b, err
}
func (c *Conn) objectStore(ctx context.Context, module, local string) (jetstream.ObjectStore, membership.BusBinding, error) {
b, err := c.objectBucketOf(module, local)
if err != nil {
return nil, b, err
}
@@ -178,7 +194,7 @@ func (c *Conn) ObjectsInfo(module string, r buscalls.ObjectsRequest) (buscalls.F
if err != nil {
return buscalls.Fill{}, err
}
b, _ := c.Binding(module, r.Objects, catalogue.StorageObjectStore)
b, _ := c.objectBucketOf(module, r.Objects)
fill, err := c.streamFill("OBJ_" + b.ObjectStore)
if err != nil {
return buscalls.Fill{}, err