connstored

package
v1.132.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

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.

Types

type Inventory

type Inventory[R any] interface {
	List(ctx context.Context) ([]R, error)
	Persistent() bool
}

Inventory is the platform's connection store, as far as an enumeration reads it: every saved connection of every kind, and whether the store outlives the process.

type Row

type Row struct {
	Kind        string
	Name        string
	Description string
	CatalogID   string
}

Row is one stored connection as this package needs it, projected from whatever record type the store keeps. CatalogID is the catalog the connection names, empty for a connection that names none.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL