Documentation
¶
Overview ¶
Package storeregistry provides a concurrency-safe registry mapping a message.StorageReference.StorageInstance to the live store that backs it (ADR-063).
StorageInstance is a logical federation NAME (the producing storage component's instance name, gh#400), not a physical address — a reader holding a StorageRef cannot derive a handle on its own (it does not know the bucket, backend, or connection, and the owner may change them at runtime). This registry is the single place the owner publishes "instance X = this live store, right now"; readers resolve current truth instead of guessing or caching a stale derivation.
Lifecycle contract (enforced by the populator, the ComponentManager):
- Register on component Start, Deregister on Stop — so a reconfig (Stop→Start of a fresh instance) swaps the entry.
- Consumers resolve LAZILY per-fetch and MUST NOT cache the handle, so a stale/closed store is never held.
Ownership: the registrant (the storage component that owns the store's lifecycle) owns Close. Borrowers (graph-embedding, fusion) MUST NOT Close a resolved store.
The Registry keys on storage.StreamableStore (the superset — objectstore.Store implements it) and also exposes Store(), so it satisfies fusion's StoreResolver (Store(instance) (storage.Store, bool)) structurally while serving graph-embedding's streaming Open() — one registry, both consumers. Kept a leaf: imports only storage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps a StorageInstance name to the live StreamableStore that backs it. Safe for concurrent use. The zero value is not usable — construct with New.
func (*Registry) Deregister ¶
Deregister removes instance from the registry. Idempotent: deregistering an absent instance is a no-op. Deregister does NOT Close the store — the owning component Closes it on its own Stop.
func (*Registry) Register ¶
func (r *Registry) Register(instance string, s storage.StreamableStore) error
Register binds instance to s. It errors on an empty name, a nil store, or a duplicate: an instance already held by a live component. Duplicate ownership (two components claiming the same StorageInstance) is a wiring fault surfaced loud at Start rather than a silent registry clobber — the ADR-063 replacement for exclusive-port conflict detection, which is reconfig-fragile (B1). The populator Deregisters on Stop, so a normal reconfig (Stop→Start) never collides here; a collision means two live owners.
func (*Registry) Store ¶
Store returns the store registered under instance as a storage.Store (Get), and whether one exists. This method makes *Registry satisfy fusion's StoreResolver interface structurally (no fusion import here — keeps this a leaf). Same lazy, no-cache contract as Streamable.
func (*Registry) Streamable ¶
func (r *Registry) Streamable(instance string) (storage.StreamableStore, bool)
Streamable returns the streaming store registered under instance, and whether one exists right now. Consumers MUST call this per-fetch and MUST NOT cache the returned handle (see the lifecycle contract).