Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| 33660e619e |
1 changed files with 18 additions and 0 deletions
|
|
@ -220,6 +220,24 @@ type ObservationProvider interface {
|
||||||
Collect(ctx context.Context, opts CheckerOptions) (any, error)
|
Collect(ctx context.Context, opts CheckerOptions) (any, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ObservationSharer is an optional interface an ObservationProvider can
|
||||||
|
// implement to declare that its observation depends only on a subset of the
|
||||||
|
// inputs and may therefore be shared across check targets.
|
||||||
|
//
|
||||||
|
// ShareKey returns a stable string derived purely from the inputs that affect
|
||||||
|
// the result (e.g. the sorted IP set + ping count). Two collections with the
|
||||||
|
// same ShareKey produce identical data; the host may serve one from the other.
|
||||||
|
// Return "" to opt out (the host falls back to per-target caching).
|
||||||
|
//
|
||||||
|
// ShareKey MUST be a pure function of opts: no network, no I/O. The host calls
|
||||||
|
// it before deciding whether to collect, possibly on the locally registered
|
||||||
|
// provider even when actual collection is delegated to a remote endpoint.
|
||||||
|
//
|
||||||
|
// Detect support with a type assertion: _, ok := provider.(ObservationSharer)
|
||||||
|
type ObservationSharer interface {
|
||||||
|
ShareKey(opts CheckerOptions) (string, error)
|
||||||
|
}
|
||||||
|
|
||||||
// CheckRuleInfo is the JSON-serializable description of a rule, for API/UI listing.
|
// CheckRuleInfo is the JSON-serializable description of a rule, for API/UI listing.
|
||||||
type CheckRuleInfo struct {
|
type CheckRuleInfo struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue