Documentation
¶
Overview ¶
Package connstored answers what connections a deployment holds, from the store that holds them.
A connection exists because there is a row for it. Several replicas run over one database, and a connection saved through one of them is a row before it is anything in the others' memory, so an inventory taken from what a process serves is an inventory of that process: an operator who adds a connection and asks what exists is answered differently depending on which replica the load balancer picked (#1757).
What a row cannot answer on its own is how large a connection's surface is, because that is a property of the specs its catalog holds — also rows, in a different table. The count is resolved here rather than by the enumeration, so a caller deciding whether to look further at a connection is told the same number wherever it asks.
It holds no platform types: the store arrives as a generic lister with a projection, which is what lets pkg/platform build one without this package importing it back.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New[R any](store Inventory[R], catalogs func() apicatalog.Store, row func(R) Row) connview.StoreLister
New adapts the platform's connection store to the inventory an enumeration reads, resolving each connection's operation count against catalogs when a catalog store is wired.
catalogs is asked for the store rather than handed one, because an enumeration built while the platform is still assembling itself would otherwise capture the nil the catalog store is before it is wired and report no surface for the life of the process.
A nil store, or one that does not outlive the process and so holds nothing another replica wrote, adapts to nil: where every replica knows only what it was handed, what it was handed is the whole inventory.