Rust · Scans

Scans

use ustore::BlobsCursorConfig;use ustore::BlobsSampleConfig;use ustore::Cursor;use ustore::Measurement;use ustore::Page;use ustore::Scanned;use ustore::Sample;use ustore::Admission;use ustore::CaseSensitivity;use ustore::ChangeKind;use ustore::Changes;use ustore::ChangesCursor;use ustore::ChangesCursorConfig;use ustore::KeyRange;use ustore::Matching;use ustore::PatternKind;use ustore::PredicateCost;use ustore::ScanDirection;use ustore::ScanMode;use ustore::DocsCursor;use ustore::DocsCursorConfig;use ustore::DocsSampleConfig;use ustore::DocsScanConfig;use ustore::PagesCursor;use ustore::PagesCursorConfig;use ustore::PagesSampleConfig;use ustore::blobs::Scan;use ustore::blobs::Sample;use ustore::blobs::Measure;use ustore::docs::DocsScan;use ustore::docs::DocsSample;use ustore::docs::DocsMeasure;use ustore::pages::PagesSample;use ustore::pages::PagesMeasure;use ustore::*; 1.0.0-rc.1 · d6d40961

API

Types

PredicateCallbackA caller's verdict on one page of listed keys, writing one Admission per key, every one starting as Admission::Reject.
db.rs:3363 ↗
pub type PredicateCallback<'handler> = dyn FnMut(&[Key], &mut [Admission]) + Send + 'handler;

It runs on whichever thread runs the call, never on two at once within one call, so it owes Send and may be FnMut. A panic inside it rejects the rest of the call's keys and resurfaces once the call is final.

Mirrors ustore_predicate_callback_t.

StructBlobsCursorConfigWhat admits the keys a cursor hands out; see On::cursor.
blobs.rs:333 ↗
pub struct BlobsCursorConfig<'config>

Fields

matchingMatching<'config>Admits only the keys it approves; every key by default.

Implements

Debug, Default, From<Matching<'config>>
StructBlobsSampleConfigThe keys a sample draws; see On::sample.
blobs.rs:320 ↗
pub struct BlobsSampleConfig

Fields

wantedusizeKeys drawn, at most.

Implements

Clone, Copy, Debug, From<usize>
StructCursorA walk over the keys of one collection, which every pull resumes past the last key the pull before it handed out, so a key written behind the walk is never handed out and one written ahead of it is; see On::cursor.2
blobs.rs:1171 ↗
pub struct Cursor<'view>

A page shorter than wanted exhausts the walk for good, so every pull after it hands out nothing, even once more keys are written. A pull that fails leaves the cursor where it was.

Mirrors ustore_blobs_cursor_t; dropping it calls ustore_blobs_cursor_free.

Implements

Debug, Drop
*× 3Pulls up to wanted next keys into arena, fewer once the walk nears its end and none past it.
blobs.rs:1183 ↗
pub fn next<'arena>(&mut self, wanted: usize, arena: &'arena mut Arena) -> Result<&'arena [Key]>

Calls ustore_blobs_cursor_next.

Calls ustore_docs_cursor_next.

Calls ustore_pages_cursor_next.

next_pairsPulls up to wanted next keys with their values into arena in one call, where a key removed at the head between the listing and the read of one pull reads as an empty value.
blobs.rs:1191 ↗
pub fn next_pairs<'arena>(
    &mut self,
    wanted: usize,
    arena: &'arena mut Arena,
) -> Result<Page<'arena>>

Calls ustore_blobs_cursor_next.

StructMeasurementThe bounds one measurement reported over a range of keys, each a lower and an upper estimate.
blobs.rs:439 ↗
pub struct Measurement

Fields

min_cardinalityusizeLower bound on the keys in the range.
max_cardinalityusizeUpper bound on the keys in the range.
min_value_bytesu64Lower bound on the bytes of values in the range.
max_value_bytesu64Upper bound on the bytes of values in the range.
min_space_usageu64Lower bound on the disk space the range takes.
max_space_usageu64Upper bound on the disk space the range takes.

Implements

Clone, Copy, StructuralPartialEq, PartialEq, Eq, Debug, Default, Hash
StructPageThe keys one pull of a Cursor handed out, with their values on one tape in the arena; see Cursor::next_pairs.3
blobs.rs:1244 ↗
pub struct Page<'arena>

Implements

Clone, Copy, Debug
keysThe keys of the page, in their order.
blobs.rs:1256 ↗
pub fn keys(&self) -> &'arena [Key]
getThe value of the key at index, or None past the end of the page.
blobs.rs:1261 ↗
pub fn get(&self, index: usize) -> Option<&'arena [u8]>
tapeEvery value of the page on the one tape the pull exported, without a copy.
blobs.rs:1266 ↗
pub fn tape(&self) -> Tape<'arena>
StructScannedThe keys one scan listed, and their BM25 scores when its patterns carried weights; see On::scan.
blobs.rs:969 ↗
pub struct Scanned<'arena>

Fields

keys&'arena [Key]The keys, in the order of the scan's direction.
scoresOption<&'arena [f32]>One score per key when the patterns carried weights.

Implements

Clone, Copy, Debug
StructSampleKeys drawn at random from a collection, with the values read under them through the same view into an arena.3
collection.rs:422 ↗
pub struct Sample<'arena>

Implements

Clone, Debug
keysThe keys drawn, in the order of their values.
collection.rs:429 ↗
pub fn keys(&self) -> &[Key]
valuesThe value under every key, where a key removed between the draw and the read is missing.
collection.rs:434 ↗
pub fn values(&self) -> Values<'arena>
SampleA random draw of keys from one collection; see On::sample.
blobs.rs:1038 ↗
pub struct Sample<'arena>

Implements

Debug
EnumAdmissionWhether a predicate keeps a listed key or passes over it, as ustore_admission_t spells it.
db.rs:3222 ↗
pub enum Admission

Values

Reject0Pass over the key.
Admit1Keep the key among the listed ones.

Implements

Clone, Copy, StructuralPartialEq, PartialEq, Eq, Debug, Default, Hash
EnumCaseSensitivityWhether patterns compare bytes as they are or after Unicode case folding, as ustore_case_sensitivity_t spells it.
db.rs:3244 ↗
pub enum CaseSensitivity

Values

Cased0Bytes as they are.
Uncased1Full Unicode case folding of both the patterns and the values.

Implements

Clone, Copy, StructuralPartialEq, PartialEq, Eq, Debug, Default, Hash, Display, FromStr
EnumChangeKindWhat one committed change did to its key.
db.rs:4421 ↗
pub enum ChangeKind

Values

Write0Wrote the whole value.
Removal1Removed the key.
Change2Changed part of the value, as a document patch or a page edit does.

Implements

Clone, Copy, StructuralPartialEq, PartialEq, Eq, Debug, Hash, Display, FromStr
StructChangesThe changes one pull of a ChangesCursor handed out, oldest first, in the arena it filled.6
db.rs:4590 ↗
pub struct Changes<'arena>

Implements

Clone, Copy, Debug
lenHow many changes the pull handed out.
db.rs:4599 ↗
pub fn len(&self) -> usize
is_emptyWhether the feed reached the newest commit.
db.rs:4604 ↗
pub fn is_empty(&self) -> bool
keysThe key of every change.
db.rs:4609 ↗
pub fn keys(&self) -> &'arena [Key]
stampsThe stamp every change was committed at.
db.rs:4614 ↗
pub fn stamps(&self) -> &'arena [CommitStamp]
kindsWhat every change did.
db.rs:4619 ↗
pub fn kinds(&self) -> &'arena [ChangeKind]
valueThe bytes the change at index carries, empty for a removal, or None past the end or when the pull read no values.
db.rs:4625 ↗
pub fn value(&self, index: usize) -> Option<&'arena [u8]>
StructChangesCursorA feed of the changes committed to one collection after a stamp, oldest first, which every pull resumes past the last change the pull before it handed out; see Database::changes_cursor.2
db.rs:4513 ↗
pub struct ChangesCursor<'database>

It pins the stamp it reads from, as a snapshot does, and holds its database open until it is dropped. A pull that fails leaves it where it was.

Implements

Debug, Drop
nextPulls up to wanted next changes into arena, none once the feed is at its newest commit.
db.rs:4520 ↗
pub fn next<'arena>(&mut self, wanted: usize, arena: &'arena mut Arena) -> Result<Changes<'arena>>
next_pairsPulls up to wanted next changes with the bytes every one carries into arena in one call.
db.rs:4525 ↗
pub fn next_pairs<'arena>(
    &mut self,
    wanted: usize,
    arena: &'arena mut Arena,
) -> Result<Changes<'arena>>
StructChangesCursorConfigWhere a feed of changes starts; see Database::changes_cursor.
db.rs:4496 ↗
pub struct ChangesCursorConfig

Fields

sinceCommitStampThe feed hands out the changes committed after this stamp.

Implements

Clone, Copy, Debug, Default, From<CommitStamp>
StructKeyRangeThe keys a scan, a cursor or a measure walks: from start, inclusive, towards end, exclusive, in the order direction names.
db.rs:1435 ↗
pub struct KeyRange

A key converts into the ascending range from it, and start..end into the one between them.

Fields

startOption<Key>The key the walk starts from, or None for the first key in its direction.
endOption<Key>The key the walk stops before, or None to walk to the last key in its direction.
directionScanDirectionWhich way the walk goes from start.

Implements

Clone, Copy, StructuralPartialEq, PartialEq, Eq, Debug, Default, Hash, From<Key>, From<Range<Key>>
StructMatchingWhat a scan or a cursor narrows its keys by, every part left empty to keep every key: patterns over the values of blobs, a JSONPath or XPath filter over documents and pages, and a predicate over the keys.
db.rs:3370 ↗
pub struct Matching<'matching>

Mirrors the patterns, filter and predicate fields of ustore_blobs_scan_t and its kin.

Fields

patterns&'matching [&'matching str]The patterns every listed value matches one of, compiled once per call or once per cursor.
pattern_kindPatternKindWhat the patterns are matched as.
sensitivityCaseSensitivityWhether matching folds case.
weightsOption<&'matching [f32]>One weight per substring pattern, which turns on BM25 scores.
filterOption<&'matching str>The JSONPath, root filter or XPath every listed document or page matches.
predicateOption<&'matching mut PredicateCallback<'matching>>The caller's verdict on the keys of every page.
predicate_costPredicateCostWhere the predicate is asked.

Implements

From<Matching<'config>>, Default, Debug
EnumPatternKindWhat the patterns of a Matching are matched as, as ustore_pattern_kind_t spells it.
db.rs:3233 ↗
pub enum PatternKind

Values

Regex0Regular expressions, of which a value matches at least one somewhere.
Substrings1Literal substrings, of which a value holds at least one.

Implements

Clone, Copy, StructuralPartialEq, PartialEq, Eq, Debug, Default, Hash, Display, FromStr
EnumPredicateCostWhere a scan asks its predicate, as ustore_predicate_cost_t spells it.
db.rs:3255 ↗
pub enum PredicateCost

Values

Cheap0Once per page, before patterns or filters read any value, so it narrows those reads.
Expensive1Once per page about the keys patterns and filters kept, for handlers that pay per call.

Implements

Clone, Copy, StructuralPartialEq, PartialEq, Eq, Debug, Default, Hash, Display, FromStr
EnumScanDirectionWhich way a scan, a cursor or a measure walks its range from the start key.
db.rs:1349 ↗
pub enum ScanDirection

Values

Ascending0Up from the start key, smallest key first.
Descending1Down from the start key, largest key first.

Implements

Clone, Copy, StructuralPartialEq, PartialEq, Eq, Debug, Default, Hash, Display, FromStr
EnumScanModeIn what order a scan hands its keys over.
db.rs:1391 ↗
pub enum ScanMode

Values

Ordered0In the order of the scan's direction.
Unordered1In any order, possibly removed or repeated, to speed up the read after the scan.

Implements

Clone, Copy, StructuralPartialEq, PartialEq, Eq, Debug, Default, Hash, Display, FromStr
StructDocsCursorA walk over the keys of one documents collection, which every pull resumes past the last key the pull before it handed out, as a crate::Cursor walks blobs, keeping the keys its Matching admits.1
docs.rs:2902 ↗
pub struct DocsCursor<'view>

Mirrors ustore_docs_cursor_t; dropping it calls ustore_docs_cursor_free.

Implements

Debug, Drop
next_pairsPulls up to wanted next keys with their whole documents into arena in one call.
docs.rs:2960 ↗
pub fn next_pairs<'arena>(
    &mut self,
    wanted: usize,
    arena: &'arena mut Arena,
) -> Result<Page<'arena>>

Calls ustore_docs_cursor_next.

StructDocsCursorConfigWhat admits the keys a cursor hands out; see On::docs_cursor.
docs.rs:1039 ↗
pub struct DocsCursorConfig<'config>

Fields

matchingMatching<'config>Admits only the documents its filter and predicate approve; every document by default.

Implements

Debug, Default, From<Matching<'config>>
StructDocsSampleConfigThe document keys a sample draws; see On::docs_sample.
docs.rs:1013 ↗
pub struct DocsSampleConfig

Fields

wantedusizeKeys drawn, at most.

Implements

Clone, Copy, Debug, From<usize>
StructDocsScanConfigThe document keys a scan keeps, what admits them and how it reports; see On::docs_scan.
docs.rs:989 ↗
pub struct DocsScanConfig<'config>

Fields

wantedusizeKeys kept, at most.
matchingMatching<'config>Admits only the documents its filter and predicate approve; every document by default.
modeScanModeIn what order the keys come.
progressOption<&'config mut ProgressCallback<'config>>Reports the scans finished and stops wherever it says to.

Implements

From<usize>
StructPagesCursorA walk over the keys of one pages collection, which every pull resumes past the last key the pull before it handed out, as a crate::Cursor walks blobs, keeping the keys its Matching admits.1
pages.rs:1438 ↗
pub struct PagesCursor<'view>

Mirrors ustore_pages_cursor_t; dropping it calls ustore_pages_cursor_free.

Implements

Debug, Drop
next_pairsPulls up to wanted next keys with their pages rendered as encoding names into arena in one call.
pages.rs:1497 ↗
pub fn next_pairs<'arena>(
    &mut self,
    wanted: usize,
    arena: &'arena mut Arena,
    encoding: PageEncoding,
) -> Result<Page<'arena>>

Calls ustore_pages_cursor_next.

StructPagesCursorConfigWhat admits the page keys a cursor hands out; see On::pages_cursor.
pages.rs:454 ↗
pub struct PagesCursorConfig<'config>

Fields

matchingMatching<'config>Admits only the pages its filter and predicate approve; every page by default.

Implements

Debug, Default, From<Matching<'config>>
StructPagesSampleConfigThe page keys a sample draws; see On::pages_sample.
pages.rs:441 ↗
pub struct PagesSampleConfig

Fields

wantedusizePage keys drawn, at most.

Implements

Clone, Copy, Debug, From<usize>
StructScanA walk over the keys of one collection; see On::scan.
blobs.rs:953 ↗
pub struct Scan<'arena, 'matching>

Implements

Debug
StructMeasureAn estimate of what a range of keys holds; see On::measure.
blobs.rs:1083 ↗
pub struct Measure<'arena>

Implements

Debug
StructDocsScanA walk over the document keys of one collection; see On::docs_scan.
docs.rs:1722 ↗
pub struct DocsScan<'arena, 'matching>

Implements

Debug
StructDocsSampleA random draw of document keys from one collection; see On::docs_sample.
docs.rs:1786 ↗
pub struct DocsSample<'arena>

Implements

Debug
StructDocsMeasureAn estimate of what a range of documents holds; see On::docs_measure.
docs.rs:1831 ↗
pub struct DocsMeasure<'arena>

Implements

Debug
StructPagesSampleA random draw of page keys from one collection; see On::pages_sample.
pages.rs:1332 ↗
pub struct PagesSample<'arena>

Implements

Debug
StructPagesMeasureAn estimate of what a range of pages holds; see On::pages_measure.
pages.rs:1377 ↗
pub struct PagesMeasure<'arena>

Implements

Debug