pub struct Calibration { /* private fields */ }Expand description
Process-wide calibration store. Concurrent updates are serialized via
a single RwLock because update events are rare (one per keyhog calibrate invocation or per verifier outcome) and the locked region is
constant-time. We deliberately don’t shard via DashMap - the persisted
artifact is small enough that contention is a non-issue.
Implementations§
Source§impl Calibration
impl Calibration
pub fn try_load(path: &Path) -> Result<Option<Self>, CalibrationLoadError>
pub fn save(&self, path: &Path) -> Result<()>
Sourcepub fn record_outcome(&self, detector_id: &str, true_positive: bool)
pub fn record_outcome(&self, detector_id: &str, true_positive: bool)
Record an operator-confirmed outcome for detector_id.
Sourcepub fn counters(&self, detector_id: &str) -> BetaCounters
pub fn counters(&self, detector_id: &str) -> BetaCounters
Return the full counters for detector_id (defaults to Beta(1, 1)).
Sourcepub fn entries(&self) -> Vec<(String, BetaCounters)>
pub fn entries(&self) -> Vec<(String, BetaCounters)>
Iterate every recorded (detector_id, counters). Useful for
keyhog calibrate --show.
Trait Implementations§
Source§impl Debug for Calibration
impl Debug for Calibration
Source§impl Default for Calibration
impl Default for Calibration
Source§fn default() -> Calibration
fn default() -> Calibration
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for Calibration
impl !RefUnwindSafe for Calibration
impl Send for Calibration
impl Sync for Calibration
impl Unpin for Calibration
impl UnsafeUnpin for Calibration
impl UnwindSafe for Calibration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more