kvseed

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package kvseed is the KV store-seed Materializer: it reconciles KV/<namespace>.jsonl packs (chassis/storeseed) into the tenant KV store.

A pack is NDJSON, one item per line:

{"key":"…","value":<any JSON>,"ttl":<seconds, optional>}

Each pack OWNS its namespace (managed scope): reconcile sets every item and deletes any key in the namespace absent from the pack (desired-state sync).

**Managed-scope hazard (read this).** The KV namespace for a runtime txco://kv/* op defaults to the routed STACK name. A seeded namespace is delete-missing'd against its pack, so it must be a namespace NO runtime op writes — never the stack's own name and never a runtime namespace (driplit's peek/library/session). Keep seed config in a dedicated namespace (e.g. KV/config.jsonl) so reconcile never wipes runtime state.

TTL on a seed means the key self-expires between applies (re-set on each re-apply); persistent config omits ttl.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Key   string          `json:"key"`
	Value json.RawMessage `json:"value"`
	TTL   int64           `json:"ttl,omitempty"` // seconds; 0/absent = persistent
}

Item is one line of a KV pack.

type Materializer

type Materializer struct {
	// contains filtered or unexported fields
}

Materializer reconciles KV packs into a *kv.KV.

func New

func New(kv *kvstore.KV, shared bool) *Materializer

New builds the KV Materializer. shared declares whether the KV backend is fleet-shared (redis) — reconciled once on the origin — or per-node (boltdb) — reconciled on every node. The wiring layer (server.go) knows the backend.

func (*Materializer) Kind

func (m *Materializer) Kind() string

func (*Materializer) Reconcile

func (m *Materializer) Reconcile(ctx context.Context, scope storeseed.Scope, packs []storeseed.RawPack) error

func (*Materializer) Shared

func (m *Materializer) Shared() bool

Jump to

Keyboard shortcuts

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