Python · Scans

Scans

import ustorefrom ustore import Keys, Page, Cursor, … 1.0.0-rc.1 · d6d40961

API

Types

ScanModeIn what order a scan hands its keys over, valued as ustore_scan_mode_t.
__init__.py:133 ↗
class ScanMode(IntEnum)

Values

ORDERED0
UNORDERED1
ScanDirectionWhich way a scan, a cursor or a measurement walks its range from the start key.
__init__.py:139 ↗
class ScanDirection(IntEnum)

Values

ASCENDING0
DESCENDING1
PatternKindWhat the patterns of a scan or a cursor are matched as, valued as ustore_pattern_kind_t.
__init__.py:185 ↗
class PatternKind(IntEnum)

Values

REGEX0
SUBSTRINGS1
CaseSensitivityWhether patterns compare bytes as they are or after Unicode case folding, valued as ustore_case_sensitivity_t.
__init__.py:191 ↗
class CaseSensitivity(IntEnum)

Values

CASED0
UNCASED1
PredicateCostWhere a scan asks its predicate: before patterns and filters read values, or last, valued as ustore_predicate_cost_t.
__init__.py:198 ↗
class PredicateCost(IntEnum)

Values

CHEAP0
EXPENSIVE1
ChangeKindWhat one committed change did to its key.
__init__.py:286 ↗
class ChangeKind(IntEnum)

Values

WRITE0
REMOVAL1
CHANGE2
PredicateCalled with the keys one page of a scan or a pull listed, from whichever thread runs it, answering one truthy item per key kept; a raise rejects the rest and re-raises once the call is final.
__init__.py:66 ↗
type Predicate = Callable[[tuple[UUID, ...]], Sequence[object]]
ClassKeysThe keys one batch scan or sample wrote into an Arena, viewing it until it rewinds.4
lib.pyi:404 ↗
class Keys
__dlpack__*__dlpack__× 2A DLPack capsule over the memory the buffer protocol exports, pinning the arena until its consumer deletes it, so numpy.from_dlpack reads it in place.
lib.pyi:413 ↗
def __dlpack____dlpack__(
    *,
    stream: object | None = None,
    max_version: tuple[int, int] | None = None,
    dl_device: tuple[int, int] | None = None,
    copy: bool | None = None,
) -> object
__dlpack_device__*__dlpack_device__× 2The DLPack device of the arena: (1, 0) for host pages, (2, ordinal) for NVIDIA, (10, ordinal) for AMD.
lib.pyi:424 ↗
def __dlpack_device____dlpack_device__() -> tuple[int, int]
counts
lib.pyi:407 ↗
counts: tuple[int, ...]
scores
lib.pyi:408 ↗
scores: tuple[float, ...] | None
ClassPageThe keys one pull of a Cursor wrote into an Arena, viewing it until it rewinds; empty, so falsy, once the walk ends.2
lib.pyi:427 ↗
class Page
__buffer__The keys as an array of shape (keys, 16) bytes, pinning the arena until released.
lib.pyi:438 ↗
def __buffer__(flags: int) -> memoryview
valuesThe values of the keys, every one present, when the pull asked for them, and None otherwise.
lib.pyi:432 ↗
values: Values | None
ClassCursorA walk over the keys of one collection, which every pull resumes past the last key the one before it handed out, so a key written behind the walk never comes and one written ahead of it does.2
lib.pyi:455 ↗
class Cursor

A page shorter than wanted exhausts the walk for good, whatever is written since.

nextThe next page of up to wanted keys in arena, with their values when asked, blocking on the executor the cursor was opened through.
lib.pyi:461 ↗
def next(
    wanted: int,
    arena: Arena,
    /,
    *,
    values: bool = False,
    progress: Progress | None = None,
) -> Page

Calls ustore_blobs_cursor_next.

closeFrees the walk with the holds it kept on its database and the transaction or snapshot it reads through.
lib.pyi:465 ↗
def close() -> None
ClassChangesCursorA feed of the changes committed to one collection after a stamp, oldest first, which pins that stamp and resumes every pull past the last change the pull before it handed out.2
lib.pyi:476 ↗
class ChangesCursor
nextThe next up to wanted changes in arena, with the bytes every one carries when asked; an empty pull reached the newest commit.
lib.pyi:481 ↗
def next(
    wanted: int,
    arena: Arena,
    /,
    *,
    values: bool = False,
) -> Changes
closeFrees the feed, releasing the stamp it pinned and the hold it kept on its database.
lib.pyi:485 ↗
def close() -> None
ClassChangesThe changes one pull of a ChangesCursor answers, oldest first.4
lib.pyi:698 ↗
class Changes(structseq[Any], tuple[Page, Values | None, tuple[int, ...], tuple[ChangeKind, ...]])
keysThe Page of the key of every change, oldest change first.
lib.pyi:705 ↗
keys: Page
valuesThe Values of the bytes every change carries when the pull asked for them, or None.
lib.pyi:709 ↗
values: Values | None
stampsThe stamp every change was committed at.
lib.pyi:713 ↗
stamps: tuple[int, ...]
kindsWhat every change did.
lib.pyi:717 ↗
kinds: tuple[ChangeKind, ...]
ClassMeasurementThe bounds on what a key range holds, as measure() estimates them without walking it.6
lib.pyi:720 ↗
class Measurement(structseq[int], tuple[int, int, int, int, int, int])
min_cardinalityThe fewest entries the range may hold.
lib.pyi:725 ↗
min_cardinality: int
max_cardinalityThe most entries the range may hold.
lib.pyi:729 ↗
max_cardinality: int
min_value_bytesThe fewest bytes the values in the range may take.
lib.pyi:733 ↗
min_value_bytes: int
max_value_bytesThe most bytes the values in the range may take.
lib.pyi:737 ↗
max_value_bytes: int
min_space_usageThe fewest bytes the range may take on disk.
lib.pyi:741 ↗
min_space_usage: int
max_space_usageThe most bytes the range may take on disk.
lib.pyi:745 ↗
max_space_usage: int