Skip to main content

Db

Struct Db 

Source
pub struct Db { /* private fields */ }
Expand description

An org’s check history.

Implementations§

Source§

impl Db

Source

pub fn open(path: &Path) -> Result<Db>

Source

pub fn memory() -> Result<Db>

Source

pub fn insert(&self, monitor: &str, c: &Check) -> Result<()>

Source

pub fn recent(&self, monitor: &str, limit: usize) -> Result<Vec<Check>>

The newest checks first.

Source

pub fn rollup(&mut self, now: u64) -> Result<()>

Roll every complete hour not rolled up yet into hourly, then drop what is past its keep.

Source

pub fn counts(&self, monitor: &str, from: u64, to: u64) -> Result<(u64, u64)>

Checks and successes in [from, to): whole hours from the rollup, the rest from the raw checks.

Source

pub fn uptime(&self, monitor: &str, from: u64, to: u64) -> Result<Option<f64>>

Percent up over [from, to); none without checks.

Source

pub fn latency( &self, monitor: &str, from: u64, ) -> Result<(Option<u64>, Option<u64>)>

Latency percentiles (p50, p95) of successful checks since from.

Source

pub fn buckets( &self, monitor: &str, from: u64, to: u64, step: u64, ) -> Result<Vec<Bucket>>

Buckets of step over [from, to). Steps under an hour come from the raw checks (the last 7 days); an hour or more from the rollup (p50 and p95 then the median of the hours’).

Source

pub fn open_incident( &self, monitor: &str, started: u64, error: Option<&str>, ) -> Result<i64>

Open an incident; its id.

Source

pub fn close_incident(&self, monitor: &str, ended: u64) -> Result<()>

End the monitor’s open incident, if any.

Source

pub fn incidents( &self, monitor: Option<&str>, limit: usize, now: u64, ) -> Result<Vec<Incident>>

Incidents, newest first: one monitor’s, or every one’s.

Source

pub fn load_state<T: for<'de> Deserialize<'de>>( &self, monitor: &str, ) -> Result<Option<T>>

Source

pub fn save_state<T: Serialize>(&self, monitor: &str, s: &T) -> Result<()>

Source

pub fn forget(&self, monitor: &str) -> Result<()>

Forget a monitor: its checks, rollups, incidents and state.

Auto Trait Implementations§

§

impl !Freeze for Db

§

impl !RefUnwindSafe for Db

§

impl !Sync for Db

§

impl !UnwindSafe for Db

§

impl Send for Db

§

impl Unpin for Db

§

impl UnsafeUnpin for Db

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V