Skip to main content

Store

Struct Store 

Source
pub struct Store { /* private fields */ }

Implementations§

Source§

impl Store

Source

pub fn open(data_dir: &Path) -> Result<Self>

Open, creating the directory and file when missing, and bring the schema up to date.

Source

pub fn open_in_memory() -> Result<Self>

An in-memory store, for tests.

Source

pub fn schema_version(&self) -> Result<u32>

The schema version of the file.

Source

pub fn ingest(&self, report: &Report, raw: &Value) -> Result<IngestOutcome>

Store one report. raw is the report as received, kept verbatim in the reports row. A report equal to the project’s previous one (digest over everything except generatedAt, commit, branch, and dirty) adds no row: the previous row takes the new report’s commit, branch, body, and times, so the project shows where it was last seen, and the project’s last report time moves.

Source

pub fn ingest_at( &self, report: &Report, raw: &Value, received_at: &str, ) -> Result<IngestOutcome>

Store::ingest with the time the report counts as received at, an RFC 3339 UTC string. --demo uses it to give sample reports a history.

Source

pub fn projects(&self) -> Result<Vec<ProjectRow>>

Every project, in the order they were first seen.

Source

pub fn project(&self, id: i64) -> Result<Option<(ProjectRow, Value)>>

One project and its latest report as stored.

Source

pub fn latest_reports(&self) -> Result<Vec<(ProjectRow, Value)>>

Every project with its latest report as stored, in the order the projects were first seen.

Source

pub fn report_history( &self, project_id: i64, limit: u32, ) -> Result<Vec<ReportSummary>>

The stored reports of a project, newest first, without their bodies.

Source

pub fn create_key(&self, name: &str, repository: Option<&str>) -> Result<String>

Create a publish key and return its secret. Only the SHA-256 of the secret is stored, so this is the one time the secret exists in full. With repository, the key may publish for that repository only.

Source

pub fn keys(&self) -> Result<Vec<KeyInfo>>

Keys in creation order.

Source

pub fn key_count(&self) -> Result<u64>

Source

pub fn revoke_key(&self, name: &str) -> Result<()>

Source

pub fn verify_key(&self, secret: &str) -> Result<Option<KeyGrant>>

The grant of secret when it is a live key. A match records its use.

Source

pub fn events(&self, filter: &EventFilter) -> Result<Vec<EventRow>>

Recorded events, newest first.

Auto Trait Implementations§

§

impl !Freeze for Store

§

impl RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl UnwindSafe for Store

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more