Documentation
¶
Overview ¶
Package consulstate supplies bounded encrypted CAS documents to Consul companions.
Index ¶
- Constants
- Variables
- func Normalize(name, prefix, timeout, defaultPrefix string) (string, string, error)
- func Parse(d *caddyfile.Dispenser) (string, [][]string, error)
- func Update[T any](ctx context.Context, h *Handle, initial func() T, apply func(*T) (bool, error)) error
- func ValidText(s string, limit int) bool
- type Binding
- type Handle
Constants ¶
const MaxPayload = 384 << 10
MaxPayload keeps each encrypted value below Consul's 512 KiB KV limit.
Variables ¶
var ( ErrInvalid = errors.New("invalid Consul backend configuration or input") ErrCapacity = errors.New("Consul backend capacity reached") )
Functions ¶
func Update ¶
func Update[T any](ctx context.Context, h *Handle, initial func() T, apply func(*T) (bool, error)) error
Update retries only definite CAS conflicts, up to eight attempts. The callback must be retry-safe and keep results private until Update returns nil. Returning changed=true with an error commits terminal revocation before returning it. Network errors never retry, even when a server may already have committed.
Types ¶
type Binding ¶
type Binding struct {
// Identity is safe configuration metadata, including the effective encryption key.
Identity string
// contains filtered or unexported fields
}
Binding captures only borrowed global storage resources. It never closes them.
func Capture ¶
func Capture(storage *storageconsul.ConsulStorage) (*Binding, error)
Capture freezes an explicitly supplied Caddy storage client and encryption key. Bind is the production entry point; tests use independent disposable clients.
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle is one app-owned logical handle to a category/name document.
func (*Handle) Check ¶
Check fences a read/callback against concurrent writes without changing the key.
func (*Handle) Close ¶
Close retires only this handle, leaving pending peer work and Caddy's client intact.