Documentation
¶
Overview ¶
Package health is the platform's built-in health (ADR-0215): the storage prober, which reads a sentinel key of the KV engine and the blob store on a period and keeps each result in memory, and the dependency checker the worker-node local API answers GET /health/dependencies with.
Index ¶
Constants ¶
const ReasonStorageUnreachable = "StorageUnreachable"
ReasonStorageUnreachable is the Ready reason of a KVStore or Bucket whose storage probe fails (ADR-0215 Decision 7).
Variables ¶
This section is empty.
Functions ¶
func NewChecker ¶
func NewChecker(d CheckerDeps) local.DependencyChecker
NewChecker builds the dependency check of ADR-0215 Decision 3.
func StoreStatus ¶
StoreStatus is cur, a KVStore's or Bucket's status, at generation gen after its storage probe gave r: phase Ready with Ready True while the probe passes, else phase Degraded with Ready False StorageUnreachable and the probe error.
Types ¶
type Binding ¶ added in v0.36.1
type Binding struct {
Kind string
Aliases func(fn *v1.Function) []string
Check func(ctx context.Context, caller local.Ref, alias string) *local.DependencyReport
}
Binding is one kind of a Function's bindings the dependency check reads: Aliases lists them in spec order, and Check checks one, returning its failure or nil. A kind with no constructor below fills the fields itself.
func Blob ¶ added in v0.36.1
func Blob(rc ReadChecker, p *Prober) Binding
Blob checks a Function's blob bindings as KV checks its KV ones, against the blob probe.
func KV ¶ added in v0.36.1
func KV(rc ReadChecker, p *Prober) Binding
KV checks a Function's KV bindings: resolve and read authorization, then the KV probe's last result.
func Links ¶ added in v0.36.1
func Links(r local.Resolver, authz auth.Authorizer, st local.FunctionStore) Binding
Links checks a Function's links: the resolver's link-as-grant, link::invoke when authz is set, and that the target exists in st and is not Failed.
func SQL ¶ added in v0.36.1
func SQL(rc ReadChecker) Binding
SQL checks a Function's SQL bindings: resolve, read authorization and a Ready engine (ADR-0233 Decision 8); it has no prober target.
func Secret ¶ added in v0.42.0
func Secret(rc ReadChecker) Binding
Secret checks a Function's Secret bindings (ADR-0321 Decision 4): each bound Secret's secret::read as the caller. It reads no Secret and has no prober target, so a missing Secret passes and the start check answers for it.
type CheckerDeps ¶
type CheckerDeps struct {
Store local.FunctionStore
Bindings []Binding
}
CheckerDeps are what the dependency check reads: the metastore that holds the caller, and the kinds of bindings it checks in list order, each a provider's own (ADR-0308).
type Probe ¶
Probe reads one storage once; an error is the storage being unreachable.
type Prober ¶
type Prober struct {
// contains filtered or unexported fields
}
Prober probes each target once per interval, each probe bounded by timeout, and keeps the results in memory (ADR-0215 Decision 6). It writes nothing.
func NewProber ¶
func NewProber(c clock.Clock, interval, timeout time.Duration, probes map[Target]Probe, logger *slog.Logger) (*Prober, error)
NewProber builds a prober over probes. interval and timeout are positive and timeout is less than interval.
func (*Prober) OnChange ¶
OnChange registers fn, called after a probe whose result's Healthy differs from the target's previous one.
type ReadChecker ¶
type ReadChecker interface {
CheckRead(ctx context.Context, ns v1.NamespaceName, fn v1.ObjectName, alias string) error
}
ReadChecker resolves a caller's binding alias and authorizes a read on it, with no storage call: the KV, blob and SQL Facades' CheckRead.