Documentation
¶
Overview ¶
Package connrecords adapts the platform's connection store to the reader a toolkit answers a request for a connection it does not hold from (internal/conncatchup).
Every kind with that catch-up needs the same three things done to the platform's store: ask it for one record of this kind, translate the store's absent-record error into the kind's own, and hand back the configuration map the toolkit parses. Two kinds have it (#1714, #1746) and the next one will, so it is written once here rather than forked per kind.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
Reader is what a toolkit's connection store reads like. A kind declares its own interface of this shape, which this one satisfies.
func Saved ¶
func Saved[R any](store RecordStore[R], kind string, notFound, kindNotFound error, config func(R) map[string]any) Reader
Saved adapts the platform's connection store to the connections of one kind. kind is the connection-instance kind discriminator, notFound the store's error for a connection it does not hold, kindNotFound the toolkit's own sentinel for one, and config reads a record's configuration.
A nil store, or one that does not outlive the process and so holds nothing another replica wrote, adapts to nil: there is no catching up to do where every replica knows only what it was handed.
type RecordStore ¶
type RecordStore[R any] interface { Get(ctx context.Context, kind, name string) (R, error) Persistent() bool }
RecordStore is the platform's connection store, as far as a kind reads it: one saved connection of a kind, as the record type the store keeps, and whether the store outlives the process.