pub struct Budget {
pub looked_up: Vec<Vec<String>>,
pub this_part: usize,
pub part_limit: usize,
pub total_limit: usize,
pub written: Vec<Vec<String>>,
pub verified: Vec<Vec<String>>,
pub verifying: bool,
}Expand description
The lookups a request may still make (tools/oracle/rules_lookups.py): a single read or
write may look up 10 distinct documents, a query 20, and a batch 10 per write and 20 in all.
A document looked up again costs nothing, across the writes of a batch too, and so does the
document a request reads or writes and every document its batch writes
(tools/oracle/rules_eval.py).
The verifies of a commit count as its writes (tools/oracle/rules_verify.py). The documents
they verify cost nothing through getAfter() and existsAfter() only, and in a verify’s
condition so do the documents the batch writes.
Fields§
§looked_up: Vec<Vec<String>>Distinct documents looked up so far, by the whole request or batch.
this_part: usizeHow many of them the current write or read looked up first.
part_limit: usize§total_limit: usize§written: Vec<Vec<String>>The documents the batch writes, from databases (see Budget::add_written).
verified: Vec<Vec<String>>The documents the batch verifies, from databases (see Budget::add_verified).
verifying: boolWhether a verify is being decided (see Budget::next_verify).
Implementations§
Source§impl Budget
impl Budget
Sourcepub fn add_written(&mut self, path: Vec<String>)
pub fn add_written(&mut self, path: Vec<String>)
Records a document the batch writes (or deletes): any write of the batch may look it up for free. The document of the request being decided is free without this.
Sourcepub fn add_verified(&mut self, path: Vec<String>)
pub fn add_verified(&mut self, path: Vec<String>)
Records a document the batch verifies: any write or verify of the batch may look it up
with getAfter() or existsAfter() for free.
Sourcepub fn free(&self, path: &[String], after: bool) -> bool
pub fn free(&self, path: &[String], after: bool) -> bool
Whether path costs nothing to look up, after the writes or before them, besides the
document of the request being decided and those looked up already.
Sourcepub fn batch() -> Self
pub fn batch() -> Self
A batch of writes; call Budget::next_write before each one.
pub fn next_write(&mut self)
Sourcepub fn next_verify(&mut self)
pub fn next_verify(&mut self)
Like Budget::next_write, before a verify of the batch.