Skip to main content

Module decision

Module decision 

Source
Expand description

The one place that decides whether anonymous usage counting may run, and the token that makes that decision unforgeable.

Every emitting surface calls decide and then, if and only if it gets TelemetryDecision::Enabled, hands the contained TelemetryConsent to crate::init. TelemetryConsent has no Default, no public constructor, and cannot be built from a bool; init takes it by value. That is what makes the permission decision enforceable by the type system rather than by six init sites each remembering to re-check the same five-part predicate.

Structs§

TelemetryConsent
Proof that a specific machine, at a specific moment, was permitted to collect.

Enums§

EndpointError
Why an endpoint was refused.
TelemetryDecision
The outcome of the emit predicate.

Constants§

TELEMETRY_DIR
Directory name under $CODEWHALE_HOME that holds every telemetry file.

Functions§

decide
Resolve the emit predicate, reading the Codewhale home from the environment.
decide_in_home
Resolve the emit predicate against an explicit Codewhale home.
load_setup_state_for_decision
Load the privacy-bearing setup record for a telemetry decision.
load_setup_state_for_decision_at
Injectable form of load_setup_state_for_decision used by every surface and by regression tests.
re_decide
Re-run the predicate from the filesystem, for the flush path.
validate_endpoint
Validate a configured endpoint.