Skip to main content

Store

Struct Store 

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

Implementations§

Source§

impl Store

Source

pub fn open(path: &Path) -> Result<Self, Error>

Opens (creating when absent) the store at path, private to the user. WAL lets the kernel read while a review indexes; writers wait for each other instead of failing.

Source

pub fn known_blobs( &self, oids: &[&str], version: i64, ) -> Result<HashSet<String>, Error>

The blobs among oids that are already indexed by extractor version.

Source

pub fn record_tree( &mut self, repo: &str, rev: &str, entries: &[(String, String)], blobs: &[(String, String, Extracted)], version: i64, indexed_at: i64, ) -> Result<i64, Error>

Records one revision: the newly read blobs, then the tree’s path-to-blob table, in one transaction. Returns the tree’s id.

Source

pub fn record_notes( &mut self, repo: &str, notes: &[Note], ) -> Result<usize, Error>

Records review comments of repo, in one transaction: a new one is added, a known one (by URL) gets its current state, line and body. Returns how many were new.

Source

pub fn credit_rules( &mut self, repo: &str, credits: &[(i64, bool)], ) -> Result<usize, Error>

Credit to rules (notes, by id) from the fates of the findings that cited them: true accepted. Ids of another repository are passed over. Returns how many rules were credited.

Source

pub fn mark_not_human( &self, repo: &str, logins: &[String], ) -> Result<usize, Error>

Marks the comments of logins (the reviewing accounts) and of GitHub Apps (...[bot]) as not a person’s: the reviewer learns from people, never from its own text. Returns how many notes changed.

Source

pub fn credited_rules(&self, repo: &str) -> Result<Vec<RuleCredit>, Error>

The rules of repo findings have cited (credit from at least one fate), most accepted first.

Source

pub fn rule_credit( &self, id: i64, ) -> Result<Option<(i64, i64, bool, bool)>, Error>

A rule’s credit: (accepted, rejected, missed, human).

Source

pub fn note_id(&self, repo: &str, url: &str) -> Result<Option<i64>, Error>

The id of the note at url in repo.

Source

pub fn meta(&self, key: &str) -> Result<Option<String>, Error>

A value the host keeps beside the graph (meta), such as when a repository’s notes were backfilled.

Source

pub fn set_meta(&self, key: &str, value: &str) -> Result<(), Error>

Source

pub fn tree_id(&self, repo: &str, rev: &str) -> Result<Option<i64>, Error>

The tree of repo at commit rev, when it was recorded.

Source

pub fn scanned_blobs( &self, oids: &[&str], version: i64, ) -> Result<HashSet<String>, Error>

The blobs among oids the relation proposer of version has read.

Source

pub fn record_relations( &mut self, tree: i64, entries: &[(String, String)], scanned: &[(String, Vec<Proposed>)], version: i64, ) -> Result<(), Error>

Records what the proposer of version read from newly scanned blobs (their earlier proposals and verdicts go: they came from another version) and which files of tree were read for relations, in one transaction. A proposal plain code settled is accepted by code; the others wait for the judge. A blob another process recorded at version since this one checked (Store::scanned_blobs reads outside this transaction) is kept as it is: replacing it would drop verdicts settled on it and hand its relations’ ids to new rows.

Source

pub fn relation_paths(&self, tree: i64) -> Result<Vec<String>, Error>

The files of tree read for relations so far.

Source

pub fn relations( &self, tree: i64, paths: Option<&[String]>, ) -> Result<Vec<Relation>, Error>

The relations of the files of tree read for relations, in path and line order; paths (when given) narrows them to those files.

Source

pub fn settle_relations( &mut self, verdicts: &[Settlement], ) -> Result<usize, Error>

Records the judge’s verdicts on proposed relations (or ones it sent for review before), in one transaction; a relation plain code settled, or the judge already accepted or rejected, keeps its verdict. Returns how many changed.

Source

pub fn tree_count(&self, repo: &str) -> Result<i64, Error>

How many trees the store holds for repo.

Auto Trait Implementations§

§

impl !Freeze for Store

§

impl !RefUnwindSafe for Store

§

impl !Sync for Store

§

impl !UnwindSafe for Store

§

impl Forget for Store

§

impl Move for Store

§

impl Send for Store

§

impl Unpin for Store

§

impl UnsafeUnpin 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, 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> 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.