Documentation
¶
Overview ¶
Package isolationverify runs the isolation probe under the runtimes of the hub's executors and keeps what it found (Task 20439).
It is the half of pkg/executor/isolation.go that has a database. pkg/executor decides, at placement, what an executor's evidence means — it cannot import pkg/statedb, which imports it — and reads that evidence through a process-wide source. This package is that source, and the writer behind it: it runs a probe, classifies what came back, records the verdict per executor and runtime in isolation_evidence, appends an executor.isolation_verdict audit row when the verdict changes, and counts the probe in cloop_executor_isolation_probes_total.
Placement reads through a short-lived cache rather than the database. A lookup happens inside reject(), once per candidate, and a hub cluster's members each probe the executors they can reach: a member's own verdicts enter its cache the moment they are written, and another member's within CacheTTL.
Index ¶
- Constants
- Variables
- type Options
- type Verifier
- func (v *Verifier) Due(ex executor.IsolationClaimer, every time.Duration) bool
- func (v *Verifier) Forget(executorID string) error
- func (v *Verifier) Lookup(executorID, runtime string) (executor.IsolationRecord, bool)
- func (v *Verifier) Probe(ctx context.Context, ex executor.IsolationProber, point string) (executor.IsolationRecord, error)
- func (v *Verifier) ProbeAsync(ex executor.IsolationProber, point string) bool
- func (v *Verifier) Round(ctx context.Context, exs []executor.Executor, point string, ...) int
- func (v *Verifier) SetOnRecord(fn func(executorID string))
- func (v *Verifier) Wait()
Constants ¶
const DueAfter = 24 * time.Hour
DueAfter is how old an executor's latest attempt may be before the daily round probes it again.
Variables ¶
var ErrNoRuntime = errors.New("isolationverify: the executor runs its payloads under no sandbox runtime")
ErrNoRuntime is returned for an executor whose payloads run under no runtime — a device in host mode — where there is no claim to verify.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// DBPath is the control plane's state database. Empty keeps records in
// memory only — a test, or a directory with no control plane.
DBPath string
// Instance names this hub member on each attempt it records.
Instance string
// Now overrides the clock.
Now func() time.Time
// Logf receives one line per probe. Nil discards them.
Logf func(format string, args ...any)
// CacheTTL bounds how stale a lookup may be. Zero is 30 seconds.
CacheTTL time.Duration
}
Options configures a Verifier.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier runs probes and answers placement's lookups.
func (*Verifier) Due ¶
Due reports whether ex has no attempt recorded for its current runtime, or only one older than every.
func (*Verifier) Forget ¶
Forget drops every record for executorID — an executor gone, or one whose engine changed under the same runtime name.
func (*Verifier) Lookup ¶
func (v *Verifier) Lookup(executorID, runtime string) (executor.IsolationRecord, bool)
Lookup implements executor.IsolationEvidenceSource.
func (*Verifier) Probe ¶
func (v *Verifier) Probe(ctx context.Context, ex executor.IsolationProber, point string) (executor.IsolationRecord, error)
Probe runs the probe once under ex's runtime now and records what came of it. point names where it was asked from (executor.ProbePoint*).
A probe that could not run returns its error and records only the attempt: the verdict an earlier probe reached stands.
func (*Verifier) ProbeAsync ¶
func (v *Verifier) ProbeAsync(ex executor.IsolationProber, point string) bool
ProbeAsync runs Probe in the background, once at a time per executor and runtime, and reports whether it started one. The probe is bounded by probeTimeout; nothing waits on it but Wait.
func (*Verifier) Round ¶
func (v *Verifier) Round(ctx context.Context, exs []executor.Executor, point string, every time.Duration) int
Round probes, one at a time, every executor in exs that can be probed and is due, and returns how many it probed. It stops when ctx ends.
func (*Verifier) SetOnRecord ¶
SetOnRecord installs what runs after each recorded attempt — the hub broadcasts an executor update, so open dashboards re-read the card.