pub struct Store { /* private fields */ }Implementations§
Source§impl Store
impl Store
Sourcepub fn open(data_dir: &Path) -> Result<Self>
pub fn open(data_dir: &Path) -> Result<Self>
Open, creating the directory and file when missing, and bring the schema up to date.
Sourcepub fn open_in_memory() -> Result<Self>
pub fn open_in_memory() -> Result<Self>
An in-memory store, for tests.
Sourcepub fn schema_version(&self) -> Result<u32>
pub fn schema_version(&self) -> Result<u32>
The schema version of the file.
Sourcepub fn ingest(&self, report: &Report, raw: &Value) -> Result<IngestOutcome>
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.
Sourcepub fn ingest_at(
&self,
report: &Report,
raw: &Value,
received_at: &str,
) -> Result<IngestOutcome>
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.
Sourcepub fn projects(&self) -> Result<Vec<ProjectRow>>
pub fn projects(&self) -> Result<Vec<ProjectRow>>
Every project, in the order they were first seen.
Sourcepub fn project(&self, id: i64) -> Result<Option<(ProjectRow, Value)>>
pub fn project(&self, id: i64) -> Result<Option<(ProjectRow, Value)>>
One project and its latest report as stored.
Sourcepub fn latest_reports(&self) -> Result<Vec<(ProjectRow, Value)>>
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.
Sourcepub fn report_history(
&self,
project_id: i64,
limit: u32,
) -> Result<Vec<ReportSummary>>
pub fn report_history( &self, project_id: i64, limit: u32, ) -> Result<Vec<ReportSummary>>
The stored reports of a project, newest first, without their bodies.
Sourcepub fn create_key(&self, name: &str, repository: Option<&str>) -> Result<String>
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.