Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrIntegrity = errors.New("configsync: snapshot integrity mismatch")
var ErrLKGCorrupt = errors.New("configsync: last-known-good snapshot is corrupt")
var ErrNotReady = errors.New("configsync: snapshot not ready")
var ErrReadOnly = errors.New("configsync: store is read-only")
ErrTransportUnavailable marks a config-sync transport disconnect that is expected and self-healing: a control-plane restart or rollout (graceful GOAWAY, surfaced by gRPC as codes.Unavailable), a transient network blip, or a clean stream EOF. Adapters wrap such errors with this sentinel so the watch loop demotes them to WARN and simply reconnects, instead of raising ERROR alarms on routine control-plane rollouts.
Functions ¶
func ReadinessCheck ¶
func ReadinessCheck[T any](store ConfigStore[T]) func(context.Context) error
Types ¶
type AESGCMCrypto ¶
type AESGCMCrypto struct {
// contains filtered or unexported fields
}
func NewAESGCMCrypto ¶
func NewAESGCMCrypto(key []byte) (*AESGCMCrypto, error)
type ConfigFetcher ¶
type ConfigStore ¶
type LKGStore ¶
type LKGStore[T any] struct { // contains filtered or unexported fields }
func NewLKGStore ¶
func NewLKGStore[T any](crypto Crypto, codec SnapshotCodec[T], path string) *LKGStore[T]
type MemoryStore ¶
type MemoryStore[T any] struct { // contains filtered or unexported fields }
func NewMemoryStore ¶
func NewMemoryStore[T any]() *MemoryStore[T]
func (*MemoryStore[T]) Load ¶
func (s *MemoryStore[T]) Load() (*Versioned[T], bool)
func (*MemoryStore[T]) Swap ¶
func (s *MemoryStore[T]) Swap(v *Versioned[T])
func (*MemoryStore[T]) Version ¶
func (s *MemoryStore[T]) Version() string
type SnapshotCodec ¶
type StreamTransport ¶
type StreamTransport interface {
Watch(ctx context.Context) (version string, err error)
Ack(ctx context.Context, appliedVersion string) error
}
StreamTransport is the DP-side control channel: block for the next change notice, and report the version the data plane has applied. Implementations (the gRPC client) reconnect internally with backoff.
type Worker ¶
type Worker[T any] struct { // contains filtered or unexported fields }
func NewWorker ¶
func NewWorker[T any]( fetcher ConfigFetcher, store ConfigStore[T], transport StreamTransport, lkg *LKGStore[T], codec SnapshotCodec[T], logger *slog.Logger, cfg WorkerConfig, opts ...WorkerOption[T], ) *Worker[T]
NewWorker builds a convergence worker that drives the config-sync stream transport for change notices/acks and the fetcher for chunked snapshot pulls.
type WorkerConfig ¶
type WorkerOption ¶
WorkerOption customizes a Worker at construction time.
func WithOnApplied ¶
func WithOnApplied[T any](fn func(context.Context)) WorkerOption[T]
WithOnApplied registers a hook run after a new snapshot version is swapped into the store. The data plane uses it to invalidate caches derived from the snapshot so edits to already-served gateways take effect without a restart.