pub struct Store { /* private fields */ }Implementations§
Source§impl Store
impl Store
Sourcepub fn open(path: &Path) -> Result<Self, Error>
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.
Sourcepub fn known_blobs(
&self,
oids: &[&str],
version: i64,
) -> Result<HashSet<String>, Error>
pub fn known_blobs( &self, oids: &[&str], version: i64, ) -> Result<HashSet<String>, Error>
The blobs among oids that are already indexed by extractor version.
Sourcepub fn record_tree(
&mut self,
repo: &str,
rev: &str,
entries: &[(String, String)],
blobs: &[(String, String, Extracted)],
version: i64,
indexed_at: i64,
) -> Result<i64, Error>
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.
Sourcepub fn record_notes(
&mut self,
repo: &str,
notes: &[Note],
) -> Result<usize, Error>
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.
Sourcepub fn credit_rules(
&mut self,
repo: &str,
credits: &[(i64, bool)],
) -> Result<usize, Error>
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.
Sourcepub fn mark_not_human(
&self,
repo: &str,
logins: &[String],
) -> Result<usize, Error>
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.
Sourcepub fn credited_rules(&self, repo: &str) -> Result<Vec<RuleCredit>, Error>
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.
Sourcepub fn rule_credit(
&self,
id: i64,
) -> Result<Option<(i64, i64, bool, bool)>, Error>
pub fn rule_credit( &self, id: i64, ) -> Result<Option<(i64, i64, bool, bool)>, Error>
A rule’s credit: (accepted, rejected, missed, human).
Sourcepub fn note_id(&self, repo: &str, url: &str) -> Result<Option<i64>, Error>
pub fn note_id(&self, repo: &str, url: &str) -> Result<Option<i64>, Error>
The id of the note at url in repo.
Sourcepub fn meta(&self, key: &str) -> Result<Option<String>, Error>
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.
pub fn set_meta(&self, key: &str, value: &str) -> Result<(), Error>
Sourcepub fn tree_id(&self, repo: &str, rev: &str) -> Result<Option<i64>, Error>
pub fn tree_id(&self, repo: &str, rev: &str) -> Result<Option<i64>, Error>
The tree of repo at commit rev, when it was recorded.
Sourcepub fn scanned_blobs(
&self,
oids: &[&str],
version: i64,
) -> Result<HashSet<String>, Error>
pub fn scanned_blobs( &self, oids: &[&str], version: i64, ) -> Result<HashSet<String>, Error>
The blobs among oids the relation proposer of version has read.
Sourcepub fn record_relations(
&mut self,
tree: i64,
entries: &[(String, String)],
scanned: &[(String, Vec<Proposed>)],
version: i64,
) -> Result<(), Error>
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.
Sourcepub fn relation_paths(&self, tree: i64) -> Result<Vec<String>, Error>
pub fn relation_paths(&self, tree: i64) -> Result<Vec<String>, Error>
The files of tree read for relations so far.
Sourcepub fn relations(
&self,
tree: i64,
paths: Option<&[String]>,
) -> Result<Vec<Relation>, Error>
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.
Sourcepub fn settle_relations(
&mut self,
verdicts: &[Settlement],
) -> Result<usize, Error>
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.
Sourcepub fn tree_count(&self, repo: &str) -> Result<i64, Error>
pub fn tree_count(&self, repo: &str) -> Result<i64, Error>
How many trees the store holds for repo.