Mojo · Platform Notes

Platform Notes

from ustore import Library, PageEncoding, PagesInsertConfig, … 1.0.0-rc.1 · d6d40961

§ What This Binding Does Not Expose

The five Arrow exports of c/ustore/arrow.h stay unbound, as Mojo has no Arrow arrays to hand them. The accessor layout of a strings batch, which reads strings through a C callback, is not exposed: Mojo passes the two tape layouts.

§ Design

Blocking stays simple: a verb on a database or on db.on(executor) reads as it would if asynchrony did not exist. Deferred calls are symmetric, the same verbs on another receiver, observed only through the outcome’s status word, and release rides Mojo’s own destructor. Nothing costs anything until used: the binding starts no threads, keeps no counts and caches nothing, so a call is one argument structure built on the stack and one indirect call.

API

StructLibraryA reference to the loaded engine, cheap to copy and shared by everything it creates.53
struct Library

Every handle carries one, which is what keeps the shared object mapped for as long as anything can still call into it.

Fields

sharedArcPointer[_Loaded]The handle and its symbols, refcounted so the last holder unmaps the object.

Conforms to

Copyable, Deinitable, ImplicitlyCopyable, Movable
__init__Opens the shared object and resolves it, which every handle then shares.
def __init__(out self)

Raises

With LIBRARY_MISSING, when nothing is on the loader path, with VERSION_MISMATCH when what loaded is another major version, or with SYMBOL_MISSING when it does not export an entry point the binding needs.
symbolsThe resolved entry points, borrowed rather than copied on every call.
def symbols(self) -> ref[self.shared.symbols] Symbols
versionThe loaded engine's major, minor and patch. Calls ustore_version.
def version(self) -> Tuple[Int, Int, Int]
version_nameThe loaded engine's own version, like "1.0.0". Calls ustore_version_name.
def version_name(self) -> String
gpu_devicesFills devices with every GPU this process can drive, in the ordinal order a VRAM executor names them by. Calls ustore_gpu_devices.
def gpu_devices[devices_origin: MutOrigin, //](
    self,
    devices: Span[GPUDevice, devices_origin]
) -> Int

Parameters

devicesSpan[GPUDevice, devices_origin]Where the listing lands, as many entries as fit; may be empty to only count.

Returns

How many devices this process can drive, which may exceed len(devices).
status_nameThe engine's spelling of a status, "unrecognized" for a code it does not name. Calls ustore_status_name.
def status_name(self, status: Status) -> String
status_from_nameReads a spelling back; INVALID_ARGUMENT when unrecognized. Calls ustore_status_from_name.
def status_from_name(self, name: StringSpan) -> Status
pattern_kind_nameThe engine's spelling of a pattern kind. Calls ustore_pattern_kind_name.
def pattern_kind_name(self, kind: PatternKind) -> String
pattern_kind_from_nameReads a spelling back; REGEX when unrecognized. Calls ustore_pattern_kind_from_name.
def pattern_kind_from_name(self, name: StringSpan) -> PatternKind
case_sensitivity_nameThe engine's spelling of a case sensitivity. Calls ustore_case_sensitivity_name.
def case_sensitivity_name(self, sensitivity: CaseSensitivity) -> String
case_sensitivity_from_nameReads a spelling back; CASED when unrecognized. Calls ustore_case_sensitivity_from_name.
def case_sensitivity_from_name(self, name: StringSpan) -> CaseSensitivity
mood_nameThe engine's spelling of a mood. Calls ustore_mood_name.
def mood_name(self, mood: Mood) -> String
mood_from_nameReads a spelling back; PARKED when unrecognized. Calls ustore_mood_from_name.
def mood_from_name(self, name: StringSpan) -> Mood
cpu_class_nameThe engine's spelling of a CPU class, "automatic" for UNKNOWN. Calls ustore_cpu_class_name.
def cpu_class_name(self, cpu_class: CPUClass) -> String
cpu_class_from_nameReads a spelling back; UNKNOWN when unrecognized. Calls ustore_cpu_class_from_name.
def cpu_class_from_name(self, name: StringSpan) -> CPUClass
transport_nameThe engine's spelling of a transport. Calls ustore_transport_name.
def transport_name(self, transport: Transport) -> String
transport_from_nameReads a spelling back; AUTOMATIC when unrecognized. Calls ustore_transport_from_name.
def transport_from_name(self, name: StringSpan) -> Transport
gds_nameThe engine's spelling of a GPUDirect Storage mode. Calls ustore_gds_name.
def gds_name(self, gds: Gds) -> String
gds_from_nameReads a spelling back; AUTOMATIC when unrecognized. Calls ustore_gds_from_name.
def gds_from_name(self, name: StringSpan) -> Gds
gpu_vendor_nameThe engine's spelling of a GPU vendor. Calls ustore_gpu_vendor_name.
def gpu_vendor_name(self, vendor: GPUVendor) -> String
gpu_vendor_from_nameReads a spelling back; UNKNOWN when unrecognized. Calls ustore_gpu_vendor_from_name.
def gpu_vendor_from_name(self, name: StringSpan) -> GPUVendor
gpu_class_nameThe engine's spelling of a GPU class. Calls ustore_gpu_class_name.
def gpu_class_name(self, gpu_class: GPUClass) -> String
gpu_class_from_nameReads a spelling back; UNKNOWN when unrecognized. Calls ustore_gpu_class_from_name.
def gpu_class_from_name(self, name: StringSpan) -> GPUClass
predicate_cost_nameThe engine's spelling of a predicate cost. Calls ustore_predicate_cost_name.
def predicate_cost_name(self, cost: PredicateCost) -> String
predicate_cost_from_nameReads a spelling back; CHEAP when unrecognized. Calls ustore_predicate_cost_from_name.
def predicate_cost_from_name(self, name: StringSpan) -> PredicateCost
durability_nameThe engine's spelling of a durability. Calls ustore_durability_name.
def durability_name(self, durability: Durability) -> String
durability_from_nameReads a spelling back; BUFFERED when unrecognized. Calls ustore_durability_from_name.
def durability_from_name(self, name: StringSpan) -> Durability
watch_nameThe engine's spelling of a watch. Calls ustore_watch_name.
def watch_name(self, watch: Watch) -> String
watch_from_nameReads a spelling back; KEYS when unrecognized. Calls ustore_watch_from_name.
def watch_from_name(self, name: StringSpan) -> Watch
scan_mode_nameThe engine's spelling of a scan mode. Calls ustore_scan_mode_name.
def scan_mode_name(self, mode: ScanMode) -> String
scan_mode_from_nameReads a spelling back; ORDERED when unrecognized. Calls ustore_scan_mode_from_name.
def scan_mode_from_name(self, name: StringSpan) -> ScanMode
scan_direction_nameThe engine's spelling of a scan direction. Calls ustore_scan_direction_name.
def scan_direction_name(self, direction: ScanDirection) -> String
scan_direction_from_nameReads a spelling back; ASCENDING when unrecognized. Calls ustore_scan_direction_from_name.
def scan_direction_from_name(self, name: StringSpan) -> ScanDirection
drop_mode_nameThe engine's spelling of a drop mode. Calls ustore_drop_mode_name.
def drop_mode_name(self, mode: DropMode) -> String
drop_mode_from_nameReads a spelling back; COLLECTION when unrecognized. Calls ustore_drop_mode_from_name.
def drop_mode_from_name(self, name: StringSpan) -> DropMode
isolation_nameThe engine's spelling of an isolation. Calls ustore_isolation_name.
def isolation_name(self, isolation: Isolation) -> String
isolation_from_nameReads a spelling back; STRICT_SERIALIZABLE when unrecognized. Calls ustore_isolation_from_name.
def isolation_from_name(self, name: StringSpan) -> Isolation
engine_nameThe engine's spelling of an engine. Calls ustore_engine_name.
def engine_name(self, engine: Engine) -> String
engine_from_nameReads a spelling back; RAM when unrecognized. Calls ustore_engine_from_name.
def engine_from_name(self, name: StringSpan) -> Engine
modality_nameThe engine's spelling of a modality. Calls ustore_modality_name.
def modality_name(self, modality: Modality) -> String
modality_from_nameReads a spelling back; NONE when unrecognized. Calls ustore_modality_from_name.
def modality_from_name(self, name: StringSpan) -> Modality
change_kind_nameThe engine's spelling of a change kind. Calls ustore_change_kind_name.
def change_kind_name(self, kind: ChangeKind) -> String
change_kind_from_nameReads a spelling back; WRITE when unrecognized. Calls ustore_change_kind_from_name.
def change_kind_from_name(self, name: StringSpan) -> ChangeKind
ingest_order_nameThe engine's spelling of an ingest order. Calls ustore_ingest_order_name.
def ingest_order_name(self, order: IngestOrder) -> String
ingest_order_from_nameReads a spelling back; SORTED when unrecognized. Calls ustore_ingest_order_from_name.
def ingest_order_from_name(self, name: StringSpan) -> IngestOrder
docs_field_type_nameThe engine's spelling of a field type, as F64 spells "f64". Calls ustore_docs_field_type_name.
def docs_field_type_name(self, field_type: FieldType) -> String
docs_field_type_from_nameReads a spelling back; JSON when unrecognized. Calls ustore_docs_field_type_from_name.
def docs_field_type_from_name(self, name: StringSpan) -> FieldType
docs_modification_nameThe engine's spelling of a modification. Calls ustore_docs_modification_name.
def docs_modification_name(self, modification: Modification) -> String
docs_modification_from_nameReads a spelling back; UPSERT when unrecognized. Calls ustore_docs_modification_from_name.
def docs_modification_from_name(self, name: StringSpan) -> Modification
vertex_role_nameThe engine's spelling of a vertex role. Calls ustore_vertex_role_name.
def vertex_role_name(self, role: VertexRole) -> String
vertex_role_from_nameReads a spelling back; UNKNOWN when unrecognized. Calls ustore_vertex_role_from_name.
def vertex_role_from_name(self, name: StringSpan) -> VertexRole
page_encoding_nameThe engine's spelling of a page encoding. Calls ustore_page_encoding_name.
def page_encoding_name(self, encoding: PageEncoding) -> String
page_encoding_from_nameReads a spelling back; HTML when unrecognized. Calls ustore_page_encoding_from_name.
def page_encoding_from_name(self, name: StringSpan) -> PageEncoding
StructPageEncodingThe encoding a page or a fragment is imported from or rendered into, ustore_page_encoding_t.
struct PageEncoding

Fields

codec_intThe raw ustore_page_encoding_t value the ABI exchanges.

Values

HTMLPageEncoding(Int32(0))HTML, not yet imported or rendered, answering UNSUPPORTED.
XMLPageEncoding(Int32(1))XML, with every element and attribute kept as written.
MARKDOWNPageEncoding(Int32(2))Markdown, not yet imported or rendered, answering UNSUPPORTED.
TEXTPageEncoding(Int32(3))The text of every run in document order, with structure dropped.
JSONPageEncoding(Int32(4))The element tree as JSON, not yet imported or rendered, answering UNSUPPORTED.

Conforms to

Copyable, Deinitable, Equatable, ImplicitlyCopyable, Movable, RegisterPassable, TrivialRegisterPassable
StructPagesInsertConfigWhere inserted fragments land, the keys they take, and how they read.1
struct PagesInsertConfig[elements_origin: ImmOrigin = ImmUntrackedOrigin, parents_origin: ImmOrigin = ImmUntrackedOrigin, anchors_origin: ImmOrigin = ImmUntrackedOrigin]

Parameters

elements_originImmOrigincomptimeThe borrowed element keys.
parents_originImmOrigincomptimeThe borrowed parents.
anchors_originImmOrigincomptimeThe borrowed anchors.

Fields

elementsStridedView[Key, elements_origin]Keys to give the inserted elements; nil or zeroed mints one.
parentsStridedView[Key, parents_origin]Parents the elements land under; nil stands for the root.
anchorsStridedView[Key, anchors_origin]Siblings after which the elements land; nil stands for the front.
encodingPageEncodingEncoding of the fragments.
durabilityDurabilityHow durable the edits are once the call finishes at the head.

Conforms to

Copyable, Deinitable, ImplicitlyCopyable, Movable
__init__Names only the knobs that differ from the defaults.
def __init__(
    out self,
    *,
    elements: StridedView[Key, elements_origin] = StridedView(),
    parents: StridedView[Key, parents_origin] = StridedView(),
    anchors: StridedView[Key, anchors_origin] = StridedView(),
    encoding: PageEncoding = PageEncoding.XML,
    durability: Durability = Durability.BUFFERED
)
StructPagesReadConfigWhich subtrees a read renders, and into what.1
struct PagesReadConfig[elements_origin: ImmOrigin = ImmUntrackedOrigin]

Parameters

elements_originImmOrigincomptimeThe borrowed element keys.

Fields

elementsStridedView[Key, elements_origin]Elements to render with their subtrees; zeroed or nil renders whole pages.
outputs_encodingPageEncodingEncoding the renderings are converted into.
valuesBoolWhether the renderings come too, or only presences and lengths.

Conforms to

Copyable, Deinitable, ImplicitlyCopyable, Movable
__init__Names only the knobs that differ from the defaults.
def __init__(
    out self,
    *,
    elements: StridedView[Key, elements_origin] = StridedView(),
    outputs_encoding: PageEncoding = PageEncoding.XML,
    values: Bool = True
)
StructPagesScanConfigThe bounds, order and filter of a scan over page keys.1
struct PagesScanConfig[end_origin: ImmOrigin = ImmUntrackedOrigin, filter_origin: ImmOrigin = ImmUntrackedOrigin]

Parameters

end_originImmOrigincomptimeThe borrowed end keys.
filter_originImmOrigincomptimeThe borrowed filter.

Fields

end_keysStridedView[Key, end_origin]Key every scan stops before, exclusive; zeroed bounds nothing.
directionScanDirectionAscending or descending from the start keys.
modeScanModeIn what order the page keys come.
filterBytesView[filter_origin]A path in StringZilla's XPath subset every listed page holds a node of; zeroed lists every page.
predicatePredicateThe caller's verdict on the listed keys.
progressProgressReports the scans finished, and stops the call where it says to.

Conforms to

Copyable, Deinitable, ImplicitlyCopyable, Movable
__init__Names only the knobs that differ from the defaults.
def __init__(
    out self,
    *,
    end_keys: StridedView[Key, end_origin] = StridedView(),
    direction: ScanDirection = ScanDirection.ASCENDING,
    mode: ScanMode = ScanMode.ORDERED,
    filter: BytesView[filter_origin] = BytesView(),
    predicate: Predicate = Predicate(),
    progress: Progress = Progress()
)