slatedb.uniffi

Public Python wrapper for the generated SlateDB UniFFI bindings.

Attributes

Error

MergeOperatorCallbackError

Exceptions

InternalError

Common base class for all non-exit exceptions.

Classes

SourceId

Compaction input source identifier.

CompactionStatus

Compaction lifecycle state.

SsTableId

SSTable identifier.

CompressionCodec

Compression codec used for an SSTable.

SstType

Physical SSTable type.

FilterFormat

Filter block format stored in SST metadata.

CloseReason

Reason a database or reader reports itself as closed.

FlushType

Storage layer targeted by an explicit flush.

LogLevel

Log level used by [init_logging].

Ttl

Time-to-live policy applied to an inserted value or merge operand.

MetricValue

Value stored in a metric snapshot.

DurabilityLevel

Minimum durability level required for data returned by reads and scans.

FilterContext

Opaque caller-supplied context forwarded to custom filter policies at

RowEntryKind

Kind of row entry stored in WAL iteration results.

IterationOrder

The iteration order for a scan.

CacheTarget

Cache content that [crate::Db::warm_sst] should populate.

IsolationLevel

Isolation level used when starting a transaction.

PrefixTarget

Identifies the target of a [PrefixExtractor::prefix_len] query.

SstBlockSize

Block size used for newly written SSTable blocks.

BloomFilterOptions

Options controlling how a bloom filter policy is constructed.

Checkpoint

Checkpoint metadata stored in a manifest.

CompactionSpec

Immutable compaction specification.

SsTableInfo

SSTable metadata.

SsTableHandle

A handle to a physical SSTable.

Compaction

Canonical compaction record.

VersionedCompactions

A compactions snapshot paired with its version ID.

ExternalDb

External DB reference recorded in a manifest.

KeyRange

A half-open or closed byte-key range used by scan APIs.

SsTableView

Projected SST view used by manifests and sorted runs.

SortedRun

A sorted run made up of one or more SST views.

VersionedManifest

A manifest snapshot paired with its version ID.

CompactorStateView

Read-only compactor state view.

DbStatus

Snapshot of the current database lifecycle and durability state.

FlushOptions

Options for an explicit flush request.

FoyerCacheOptions

Options for configuring Foyer DB cache.

HistogramMetricValue

Histogram payload captured in a metric snapshot.

KeyValue

A key/value pair together with the row version metadata that produced it.

LogRecord

A single log event forwarded to a foreign callback.

MergeOptions

Options applied to a merge operation.

MetricLabel

Key-value label attached to a metric.

Metric

One metric from a [DefaultMetricsRecorder] snapshot.

MokaCacheOptions

Options for configuring Moka DB cache.

PutOptions

Options applied to a put operation.

ReadOptions

Options that control a point read.

ReaderOptions

Options for opening a [crate::DbReader].

RowEntry

A raw row entry returned from WAL inspection.

ScanOptions

Options that control range scans and prefix scans.

WalFileMetadata

Metadata describing a WAL file in object storage.

WriteHandle

Metadata returned by a successful write.

WriteOptions

Options that control durability behavior for writes and commits.

Admin

Administrative read/query handle for SlateDB.

AdminProtocol

Administrative read/query handle for SlateDB.

ObjectStore

Object store handle used when opening databases, readers, and WAL readers.

ObjectStoreProtocol

Object store handle used when opening databases, readers, and WAL readers.

AdminBuilder

Builder for opening an administrative [crate::Admin] handle.

AdminBuilderProtocol

Builder for opening an administrative [crate::Admin] handle.

CounterImpl

Handle for a monotonic counter metric.

Counter

Handle for a monotonic counter metric.

DbIterator

Async iterator returned by scan APIs.

DbIteratorProtocol

Async iterator returned by scan APIs.

DbTransaction

Transaction handle returned by [crate::Db::begin].

DbTransactionProtocol

Transaction handle returned by [crate::Db::begin].

DbSnapshot

Read-only snapshot representing a consistent view of the database.

DbSnapshotProtocol

Read-only snapshot representing a consistent view of the database.

WriteBatch

Mutable batch of write operations applied atomically by [crate::Db::write].

WriteBatchProtocol

Mutable batch of write operations applied atomically by [crate::Db::write].

Db

A writable SlateDB handle.

DbProtocol

A writable SlateDB handle.

DbCache

Database cache used to store blocks in memory.

DbCacheProtocol

Database cache used to store blocks in memory.

FilterPolicy

A filter policy used to build and read SST filters.

FilterPolicyProtocol

A filter policy used to build and read SST filters.

MergeOperatorImpl

Application-provided merge operator used by merge-enabled databases.

MergeOperator

Application-provided merge operator used by merge-enabled databases.

GaugeImpl

Handle for a gauge metric.

Gauge

Handle for a gauge metric.

UpDownCounterImpl

Handle for an up/down counter metric.

UpDownCounter

Handle for an up/down counter metric.

HistogramImpl

Handle for a histogram metric.

Histogram

Handle for a histogram metric.

MetricsRecorderImpl

Application-defined metrics recorder used to publish SlateDB metrics.

MetricsRecorder

Application-defined metrics recorder used to publish SlateDB metrics.

Settings

Mutable database settings object used to configure a [crate::DbBuilder].

SettingsProtocol

Mutable database settings object used to configure a [crate::DbBuilder].

DbBuilder

Builder for opening a writable [crate::Db].

DbBuilderProtocol

Builder for opening a writable [crate::Db].

DbReader

Read-only database handle opened by [crate::DbReaderBuilder].

DbReaderProtocol

Read-only database handle opened by [crate::DbReaderBuilder].

DbReaderBuilder

Builder for opening a read-only [crate::DbReader].

DbReaderBuilderProtocol

Builder for opening a read-only [crate::DbReader].

DefaultMetricsRecorder

Built-in atomic-backed metrics recorder with snapshot access.

DefaultMetricsRecorderProtocol

Built-in atomic-backed metrics recorder with snapshot access.

LogCallbackImpl

Callback invoked for each emitted log record.

LogCallback

Callback invoked for each emitted log record.

PrefixExtractorImpl

Application-provided prefix extractor used to configure prefix-based

PrefixExtractor

Application-provided prefix extractor used to configure prefix-based

WalFileIterator

Iterator over raw row entries stored in a WAL file.

WalFileIteratorProtocol

Iterator over raw row entries stored in a WAL file.

WalFile

Handle for a single WAL file.

WalFileProtocol

Handle for a single WAL file.

WalReader

Reader for WAL files stored under a database path.

WalReaderProtocol

Reader for WAL files stored under a database path.

Functions

init_logging(→ None)

Installs SlateDB logging exactly once for the current process.

Package Contents

exception slatedb.uniffi.InternalError

Bases: Exception

Common base class for all non-exit exceptions.

class slatedb.uniffi.SourceId

Compaction input source identifier.

class SORTED_RUN(*values)

Existing sorted run ID.

class SST_VIEW(*values)

L0 SST view ULID string.

is_SORTED_RUN() bool
is_sorted_run() bool
is_SST_VIEW() bool
is_sst_view() bool
class slatedb.uniffi.CompactionStatus(*args, **kwds)

Bases: enum.Enum

Compaction lifecycle state.

SUBMITTED = 0
RUNNING = 1
COMPLETED = 2
FAILED = 3
COMPACTED = 4
class slatedb.uniffi.SsTableId

SSTable identifier.

class WAL(*values)

WAL SST identified by numeric WAL ID.

class COMPACTED(*values)

Compacted SST identified by ULID string.

is_WAL() bool
is_wal() bool
is_COMPACTED() bool
is_compacted() bool
class slatedb.uniffi.CompressionCodec(*args, **kwds)

Bases: enum.Enum

Compression codec used for an SSTable.

SNAPPY = 0
ZLIB = 1
LZ4 = 2
ZSTD = 3
class slatedb.uniffi.SstType(*args, **kwds)

Bases: enum.Enum

Physical SSTable type.

COMPACTED = 0
WAL = 1
class slatedb.uniffi.FilterFormat(*args, **kwds)

Bases: enum.Enum

Filter block format stored in SST metadata.

LEGACY = 0
COMPOSITE = 1
class slatedb.uniffi.CloseReason(*args, **kwds)

Bases: enum.Enum

Reason a database or reader reports itself as closed.

CLEAN = 0

Closed cleanly by the caller.

FENCED = 1

Closed because another writer fenced this instance.

PANIC = 2

Closed because of a panic in a background task.

UNKNOWN = 3

Closed for a reason not modeled explicitly by this binding.

class slatedb.uniffi.FlushType(*args, **kwds)

Bases: enum.Enum

Storage layer targeted by an explicit flush.

MEM_TABLE = 0

Flush the active memtable and any immutable memtables to object storage.

WAL = 1

Flush the active WAL and any immutable WAL segments to object storage.

class slatedb.uniffi.LogLevel(*args, **kwds)

Bases: enum.Enum

Log level used by [init_logging].

OFF = 0

Disable logging.

ERROR = 1

Error-level logs only.

WARN = 2

Warning and error logs.

INFO = 3

Info, warning, and error logs.

DEBUG = 4

Debug, info, warning, and error logs.

TRACE = 5

Trace and all higher-severity logs.

class slatedb.uniffi.Ttl

Time-to-live policy applied to an inserted value or merge operand.

class DEFAULT

Use the database default TTL.

class NO_EXPIRY

Store the value without expiration.

class EXPIRE_AFTER_TICKS(*values)

Expire the value after the given number of clock ticks.

class EXPIRE_AT(*values)

Expire the value at the given absolute timestamp (clock ticks).

is_DEFAULT() bool
is_default() bool
is_NO_EXPIRY() bool
is_no_expiry() bool
is_EXPIRE_AFTER_TICKS() bool
is_expire_after_ticks() bool
is_EXPIRE_AT() bool
is_expire_at() bool
class slatedb.uniffi.MetricValue

Value stored in a metric snapshot.

class COUNTER(*values)

Monotonic counter value.

class GAUGE(*values)

Gauge value.

class UP_DOWN_COUNTER(*values)

Up/down counter value.

class HISTOGRAM(*values)

Histogram summary and buckets.

is_COUNTER() bool
is_counter() bool
is_GAUGE() bool
is_gauge() bool
is_UP_DOWN_COUNTER() bool
is_up_down_counter() bool
is_HISTOGRAM() bool
is_histogram() bool
class slatedb.uniffi.DurabilityLevel(*args, **kwds)

Bases: enum.Enum

Minimum durability level required for data returned by reads and scans.

REMOTE = 0

Return only data that has been flushed to remote object storage.

MEMORY = 1

Return both remote data and newer in-memory data.

class slatedb.uniffi.FilterContext

Opaque caller-supplied context forwarded to custom filter policies at query time.

Custom filter policies read this to parametrize their evaluation; built-in policies (including the bloom filter) ignore it. The payload is opaque to SlateDB; the receiving policy is responsible for any decoding.

class BYTES(payload: bytes)

Variable-length payload. Maps to [slatedb::FilterContext::Bytes].

payload
is_BYTES() bool
is_bytes() bool
class slatedb.uniffi.RowEntryKind(*args, **kwds)

Bases: enum.Enum

Kind of row entry stored in WAL iteration results.

VALUE = 0

A regular value row.

TOMBSTONE = 1

A delete tombstone.

MERGE = 2

A merge operand row.

class slatedb.uniffi.IterationOrder(*args, **kwds)

Bases: enum.Enum

The iteration order for a scan.

ASCENDING = 0
DESCENDING = 1
class slatedb.uniffi.CacheTarget

Cache content that [crate::Db::warm_sst] should populate.

class FILTERS

Warm all filters on the SST, if any exist.

class INDEX

Warm the SST index.

class STATS

Warm the SST stats block, if one exists.

class DATA(range: KeyRange)

Warm the SST data blocks that overlap range. Also warms the index, since block planning depends on it.

range
is_FILTERS() bool
is_filters() bool
is_INDEX() bool
is_index() bool
is_STATS() bool
is_stats() bool
is_DATA() bool
is_data() bool
slatedb.uniffi.Error
class slatedb.uniffi.IsolationLevel(*args, **kwds)

Bases: enum.Enum

Isolation level used when starting a transaction.

SNAPSHOT = 0

Reads see a stable snapshot without full serializable conflict checking.

SERIALIZABLE_SNAPSHOT = 1

Reads see a stable snapshot with serializable conflict detection.

slatedb.uniffi.MergeOperatorCallbackError
class slatedb.uniffi.PrefixTarget

Identifies the target of a [PrefixExtractor::prefix_len] query.

class POINT(key: bytes)

A complete key, supplied either during SST construction or a point lookup.

key
class PREFIX(prefix: bytes)

A scan prefix supplied during a prefix scan.

prefix
is_POINT() bool
is_point() bool
is_PREFIX() bool
is_prefix() bool
class slatedb.uniffi.SstBlockSize(*args, **kwds)

Bases: enum.Enum

Block size used for newly written SSTable blocks.

BLOCK1_KIB = 0

1 KiB blocks.

BLOCK2_KIB = 1

2 KiB blocks.

BLOCK4_KIB = 2

4 KiB blocks.

BLOCK8_KIB = 3

8 KiB blocks.

BLOCK16_KIB = 4

16 KiB blocks.

BLOCK32_KIB = 5

32 KiB blocks.

BLOCK64_KIB = 6

64 KiB blocks.

class slatedb.uniffi.BloomFilterOptions(*, bits_per_key: int, whole_key_filtering: bool = True)

Options controlling how a bloom filter policy is constructed.

Pass an optional prefix extractor as a separate constructor parameter; it is kept out of this record because uniffi cannot marshal a trait object inside a record across every target language.

bits_per_key
whole_key_filtering = True
class slatedb.uniffi.Checkpoint(*, id: str, manifest_id: int, expire_time_secs: int | None, create_time_secs: int, name: str | None)

Checkpoint metadata stored in a manifest.

id
manifest_id
expire_time_secs
create_time_secs
name
class slatedb.uniffi.CompactionSpec(*, sources: List[SourceId], destination: int | None, has_l0_sources: bool, has_sr_sources: bool)

Immutable compaction specification.

sources
destination
has_l0_sources
has_sr_sources
class slatedb.uniffi.SsTableInfo(*, first_entry: bytes | None, last_entry: bytes | None, index_offset: int, index_len: int, filter_offset: int, filter_len: int, compression_codec: CompressionCodec | None, sst_type: SstType, stats_offset: int, stats_len: int, filter_format: FilterFormat)

SSTable metadata.

first_entry
last_entry
index_offset
index_len
filter_offset
filter_len
compression_codec
sst_type
stats_offset
stats_len
filter_format
class slatedb.uniffi.SsTableHandle(*, id: SsTableId, info: SsTableInfo, estimated_size_bytes: int)

A handle to a physical SSTable.

id
info
estimated_size_bytes
class slatedb.uniffi.Compaction(*, id: str, spec: CompactionSpec, bytes_processed: int, status: CompactionStatus, output_ssts: List[SsTableHandle], active: bool)

Canonical compaction record.

id
spec
bytes_processed
status
output_ssts
active
class slatedb.uniffi.VersionedCompactions(*, id: int, compactor_epoch: int, recent_compactions: List[Compaction])

A compactions snapshot paired with its version ID.

id
compactor_epoch
recent_compactions
class slatedb.uniffi.ExternalDb(*, path: str, source_checkpoint_id: str, final_checkpoint_id: str | None, sst_ids: List[SsTableId])

External DB reference recorded in a manifest.

path
source_checkpoint_id
final_checkpoint_id
sst_ids
class slatedb.uniffi.KeyRange(*, start: bytes | None, start_inclusive: bool, end: bytes | None, end_inclusive: bool)

A half-open or closed byte-key range used by scan APIs.

start
start_inclusive
end
end_inclusive
class slatedb.uniffi.SsTableView(*, id: str, sst: SsTableHandle, visible_range: KeyRange | None, estimated_size_bytes: int)

Projected SST view used by manifests and sorted runs.

id
sst
visible_range
estimated_size_bytes
class slatedb.uniffi.SortedRun(*, id: int, sst_views: List[SsTableView], estimated_size_bytes: int)

A sorted run made up of one or more SST views.

id
sst_views
estimated_size_bytes
class slatedb.uniffi.VersionedManifest(*, id: int, writer_epoch: int, compactor_epoch: int, external_dbs: List[ExternalDb], initialized: bool, last_compacted_l0_sst_view_id: str | None, last_compacted_l0_sst_id: str | None, l0: List[SsTableView], compacted: List[SortedRun], next_wal_sst_id: int, replay_after_wal_id: int, last_l0_clock_tick: int, last_l0_seq: int, recent_snapshot_min_seq: int, checkpoints: List[Checkpoint], wal_object_store_uri: str | None)

A manifest snapshot paired with its version ID.

id
writer_epoch
compactor_epoch
external_dbs
initialized
last_compacted_l0_sst_view_id
last_compacted_l0_sst_id
l0
compacted
next_wal_sst_id
replay_after_wal_id
last_l0_clock_tick
last_l0_seq
recent_snapshot_min_seq
checkpoints
wal_object_store_uri
class slatedb.uniffi.CompactorStateView(*, compactions: VersionedCompactions | None, manifest: VersionedManifest)

Read-only compactor state view.

compactions
manifest
class slatedb.uniffi.DbStatus(*, durable_seq: int, close_reason: CloseReason | None)

Snapshot of the current database lifecycle and durability state.

durable_seq
close_reason
class slatedb.uniffi.FlushOptions(*, flush_type: FlushType)

Options for an explicit flush request.

flush_type
class slatedb.uniffi.FoyerCacheOptions(*, max_capacity: int, shards: int)

Options for configuring Foyer DB cache.

max_capacity
shards
class slatedb.uniffi.HistogramMetricValue(*, count: int, sum: float, min: float, max: float, boundaries: List[float], bucket_counts: List[int])

Histogram payload captured in a metric snapshot.

count
sum
min
max
boundaries
bucket_counts
class slatedb.uniffi.KeyValue(*, key: bytes, value: bytes, seq: int, create_ts: int, expire_ts: int | None)

A key/value pair together with the row version metadata that produced it.

key
value
seq
create_ts
expire_ts
class slatedb.uniffi.LogRecord(*, level: LogLevel, target: str, message: str, module_path: str | None, file: str | None, line: int | None)

A single log event forwarded to a foreign callback.

level
target
message
module_path
file
line
class slatedb.uniffi.MergeOptions(*, ttl: Ttl)

Options applied to a merge operation.

ttl
class slatedb.uniffi.MetricLabel(*, key: str, value: str)

Key-value label attached to a metric.

key
value
class slatedb.uniffi.Metric(*, name: str, labels: List[MetricLabel], description: str, value: MetricValue)

One metric from a [DefaultMetricsRecorder] snapshot.

name
labels
description
value
class slatedb.uniffi.MokaCacheOptions(*, max_capacity: int, time_to_live: int | None, time_to_idle: int | None)

Options for configuring Moka DB cache.

max_capacity
time_to_live
time_to_idle
class slatedb.uniffi.PutOptions(*, ttl: Ttl)

Options applied to a put operation.

ttl
class slatedb.uniffi.ReadOptions(*, durability_filter: DurabilityLevel, dirty: bool, cache_blocks: bool, filter_context: FilterContext | None = _DEFAULT)

Options that control a point read.

durability_filter
dirty
cache_blocks
class slatedb.uniffi.ReaderOptions(*, manifest_poll_interval_ms: int, checkpoint_lifetime_ms: int, max_memtable_bytes: int, skip_wal_replay: bool)

Options for opening a [crate::DbReader].

manifest_poll_interval_ms
checkpoint_lifetime_ms
max_memtable_bytes
skip_wal_replay
class slatedb.uniffi.RowEntry(*, kind: RowEntryKind, key: bytes, value: bytes | None, seq: int, create_ts: int | None, expire_ts: int | None)

A raw row entry returned from WAL inspection.

kind
key
value
seq
create_ts
expire_ts
class slatedb.uniffi.ScanOptions(*, durability_filter: DurabilityLevel, dirty: bool, read_ahead_bytes: int, cache_blocks: bool, max_fetch_tasks: int, order: IterationOrder | None = _DEFAULT, filter_context: FilterContext | None = _DEFAULT)

Options that control range scans and prefix scans.

durability_filter
dirty
read_ahead_bytes
cache_blocks
max_fetch_tasks
class slatedb.uniffi.WalFileMetadata(*, last_modified_seconds: int, last_modified_nanos: int, size_bytes: int, location: str)

Metadata describing a WAL file in object storage.

last_modified_seconds
last_modified_nanos
size_bytes
location
class slatedb.uniffi.WriteHandle(*, seqnum: int, create_ts: int)

Metadata returned by a successful write.

seqnum
create_ts
class slatedb.uniffi.WriteOptions(*, await_durable: bool)

Options that control durability behavior for writes and commits.

await_durable
slatedb.uniffi.init_logging(level: LogLevel, callback: LogCallback | None) None

Installs SlateDB logging exactly once for the current process.

If callback is provided, log records are forwarded to it. Otherwise logs are written to standard error using the default tracing formatter.

class slatedb.uniffi.Admin(*args, **kwargs)

Bases: AdminProtocol

Administrative read/query handle for SlateDB.

async get_sequence_for_timestamp(timestamp_secs: int, round_up: bool) int | None

Looks up a sequence number for the provided Unix UTC timestamp seconds.

async get_timestamp_for_sequence(seq: int, round_up: bool) int | None

Looks up a timestamp for the provided sequence number.

async list_checkpoints(name_filter: str | None) List[Checkpoint]

Lists checkpoints, optionally filtering by exact name.

async list_compactions(_from: int | None, to: int | None) List[VersionedCompactions]

Lists compactions files inside the half-open ID range [from, to).

async list_manifests(_from: int | None, to: int | None) List[VersionedManifest]

Lists manifests inside the half-open ID range [from, to).

async read_compaction(compaction_id: str, compactions_id: int | None) Compaction | None

Reads a compaction by ULID string from a specific or latest compactions file.

async read_compactions(id: int | None) VersionedCompactions | None

Reads a specific compactions file by ID, or the latest when id is None.

async read_compactor_state_view() CompactorStateView

Reads the latest compactor state view.

async read_manifest(id: int | None) VersionedManifest | None

Reads a specific manifest by ID, or the latest when id is None.

class slatedb.uniffi.AdminProtocol

Bases: Protocol

Administrative read/query handle for SlateDB.

abstractmethod get_sequence_for_timestamp(timestamp_secs: int, round_up: bool) int | None
Async:

Looks up a sequence number for the provided Unix UTC timestamp seconds.

abstractmethod get_timestamp_for_sequence(seq: int, round_up: bool) int | None
Async:

Looks up a timestamp for the provided sequence number.

abstractmethod list_checkpoints(name_filter: str | None) List[Checkpoint]
Async:

Lists checkpoints, optionally filtering by exact name.

abstractmethod list_compactions(_from: int | None, to: int | None) List[VersionedCompactions]
Async:

Lists compactions files inside the half-open ID range [from, to).

abstractmethod list_manifests(_from: int | None, to: int | None) List[VersionedManifest]
Async:

Lists manifests inside the half-open ID range [from, to).

abstractmethod read_compaction(compaction_id: str, compactions_id: int | None) Compaction | None
Async:

Reads a compaction by ULID string from a specific or latest compactions file.

abstractmethod read_compactions(id: int | None) VersionedCompactions | None
Async:

Reads a specific compactions file by ID, or the latest when id is None.

abstractmethod read_compactor_state_view() CompactorStateView
Async:

Reads the latest compactor state view.

abstractmethod read_manifest(id: int | None) VersionedManifest | None
Async:

Reads a specific manifest by ID, or the latest when id is None.

class slatedb.uniffi.ObjectStore(*args, **kwargs)

Bases: ObjectStoreProtocol

Object store handle used when opening databases, readers, and WAL readers.

classmethod from_env(env_file: str | None) ObjectStore

Builds an object store from environment configuration.

When env_file is provided, environment variables are loaded from that file before constructing the store.

classmethod resolve(url: str) ObjectStore

Resolves an object store from a URL understood by SlateDB.

class slatedb.uniffi.ObjectStoreProtocol

Bases: Protocol

Object store handle used when opening databases, readers, and WAL readers.

class slatedb.uniffi.AdminBuilder(path: str, object_store: ObjectStore)

Bases: AdminBuilderProtocol

Builder for opening an administrative [crate::Admin] handle.

Builders are single-use: calling [AdminBuilder::build] consumes the builder.

build() Admin

Builds the admin handle and consumes this builder.

with_seed(seed: int) None

Sets the seed used for SlateDB’s internal random number generation.

with_wal_object_store(wal_object_store: ObjectStore) None

Uses a separate object store for WAL-backed administrative operations.

class slatedb.uniffi.AdminBuilderProtocol

Bases: Protocol

Builder for opening an administrative [crate::Admin] handle.

Builders are single-use: calling [AdminBuilder::build] consumes the builder.

abstractmethod build() Admin

Builds the admin handle and consumes this builder.

abstractmethod with_seed(seed: int) None

Sets the seed used for SlateDB’s internal random number generation.

abstractmethod with_wal_object_store(wal_object_store: ObjectStore) None

Uses a separate object store for WAL-backed administrative operations.

class slatedb.uniffi.CounterImpl(*args, **kwargs)

Bases: Counter

Handle for a monotonic counter metric.

increment(value: int) None

Adds value to the counter.

class slatedb.uniffi.Counter

Handle for a monotonic counter metric.

abstractmethod increment(value: int) None

Adds value to the counter.

class slatedb.uniffi.DbIterator(*args, **kwargs)

Bases: DbIteratorProtocol

Async iterator returned by scan APIs.

async next() KeyValue | None

Returns the next key/value pair from the iterator.

async seek(key: bytes) None

Seeks the iterator to the first entry at or after key.

class slatedb.uniffi.DbIteratorProtocol

Bases: Protocol

Async iterator returned by scan APIs.

abstractmethod next() KeyValue | None
Async:

Returns the next key/value pair from the iterator.

abstractmethod seek(key: bytes) None
Async:

Seeks the iterator to the first entry at or after key.

class slatedb.uniffi.DbTransaction(*args, **kwargs)

Bases: DbTransactionProtocol

Transaction handle returned by [crate::Db::begin].

A transaction becomes unusable after commit, commit_with_options, or rollback.

async commit() WriteHandle | None

Commits the transaction.

Returns None when the transaction performed no writes.

async commit_with_options(options: WriteOptions) WriteHandle | None

Commits the transaction using custom write options.

Returns None when the transaction performed no writes.

async delete(key: bytes) None

Buffers a delete inside the transaction.

async get(key: bytes) bytes | None

Reads the value visible to this transaction for key.

async get_key_value(key: bytes) KeyValue | None

Reads the row version visible to this transaction for key.

async get_key_value_with_options(key: bytes, options: ReadOptions) KeyValue | None

Reads the row version visible to this transaction for key using custom options.

async get_with_options(key: bytes, options: ReadOptions) bytes | None

Reads the value visible to this transaction for key using custom read options.

id() str

Returns the transaction identifier as a UUID string.

async mark_read(keys: List[bytes]) None

Marks keys as read for conflict detection.

async merge(key: bytes, operand: bytes) None

Buffers a merge operand inside the transaction.

async merge_with_options(key: bytes, operand: bytes, options: MergeOptions) None

Buffers a merge operand inside the transaction using custom merge options.

async put(key: bytes, value: bytes) None

Buffers a put inside the transaction.

async put_with_options(key: bytes, value: bytes, options: PutOptions) None

Buffers a put inside the transaction using custom put options.

async rollback() None

Rolls back the transaction and marks it completed.

async scan(range: KeyRange) DbIterator

Scans rows inside range as visible to this transaction.

async scan_prefix(prefix: bytes) DbIterator

Scans rows whose keys start with prefix as visible to this transaction.

async scan_prefix_with_options(prefix: bytes, options: ScanOptions) DbIterator

Scans rows whose keys start with prefix as visible to this transaction using custom options.

async scan_with_options(range: KeyRange, options: ScanOptions) DbIterator

Scans rows inside range as visible to this transaction using custom options.

seqnum() int

Returns the sequence number assigned when the transaction started.

async unmark_write(keys: List[bytes]) None

Excludes written keys from transaction conflict detection.

class slatedb.uniffi.DbTransactionProtocol

Bases: Protocol

Transaction handle returned by [crate::Db::begin].

A transaction becomes unusable after commit, commit_with_options, or rollback.

abstractmethod commit() WriteHandle | None
Async:

Commits the transaction.

Returns None when the transaction performed no writes.

abstractmethod commit_with_options(options: WriteOptions) WriteHandle | None
Async:

Commits the transaction using custom write options.

Returns None when the transaction performed no writes.

abstractmethod delete(key: bytes) None
Async:

Buffers a delete inside the transaction.

abstractmethod get(key: bytes) bytes | None
Async:

Reads the value visible to this transaction for key.

abstractmethod get_key_value(key: bytes) KeyValue | None
Async:

Reads the row version visible to this transaction for key.

abstractmethod get_key_value_with_options(key: bytes, options: ReadOptions) KeyValue | None
Async:

Reads the row version visible to this transaction for key using custom options.

abstractmethod get_with_options(key: bytes, options: ReadOptions) bytes | None
Async:

Reads the value visible to this transaction for key using custom read options.

abstractmethod id() str

Returns the transaction identifier as a UUID string.

abstractmethod mark_read(keys: List[bytes]) None
Async:

Marks keys as read for conflict detection.

abstractmethod merge(key: bytes, operand: bytes) None
Async:

Buffers a merge operand inside the transaction.

abstractmethod merge_with_options(key: bytes, operand: bytes, options: MergeOptions) None
Async:

Buffers a merge operand inside the transaction using custom merge options.

abstractmethod put(key: bytes, value: bytes) None
Async:

Buffers a put inside the transaction.

abstractmethod put_with_options(key: bytes, value: bytes, options: PutOptions) None
Async:

Buffers a put inside the transaction using custom put options.

abstractmethod rollback() None
Async:

Rolls back the transaction and marks it completed.

abstractmethod scan(range: KeyRange) DbIterator
Async:

Scans rows inside range as visible to this transaction.

abstractmethod scan_prefix(prefix: bytes) DbIterator
Async:

Scans rows whose keys start with prefix as visible to this transaction.

abstractmethod scan_prefix_with_options(prefix: bytes, options: ScanOptions) DbIterator
Async:

Scans rows whose keys start with prefix as visible to this transaction using custom options.

abstractmethod scan_with_options(range: KeyRange, options: ScanOptions) DbIterator
Async:

Scans rows inside range as visible to this transaction using custom options.

abstractmethod seqnum() int

Returns the sequence number assigned when the transaction started.

abstractmethod unmark_write(keys: List[bytes]) None
Async:

Excludes written keys from transaction conflict detection.

class slatedb.uniffi.DbSnapshot(*args, **kwargs)

Bases: DbSnapshotProtocol

Read-only snapshot representing a consistent view of the database.

async get(key: bytes) bytes | None

Reads the value visible in this snapshot for key.

async get_key_value(key: bytes) KeyValue | None

Reads the row version visible in this snapshot for key.

async get_key_value_with_options(key: bytes, options: ReadOptions) KeyValue | None

Reads the row version visible in this snapshot for key using custom read options.

async get_with_options(key: bytes, options: ReadOptions) bytes | None

Reads the value visible in this snapshot for key using custom read options.

async scan(range: KeyRange) DbIterator

Scans rows inside range as of this snapshot.

async scan_prefix(prefix: bytes) DbIterator

Scans rows whose keys start with prefix as of this snapshot.

async scan_prefix_with_options(prefix: bytes, options: ScanOptions) DbIterator

Scans rows whose keys start with prefix as of this snapshot using custom options.

async scan_with_options(range: KeyRange, options: ScanOptions) DbIterator

Scans rows inside range as of this snapshot using custom scan options.

class slatedb.uniffi.DbSnapshotProtocol

Bases: Protocol

Read-only snapshot representing a consistent view of the database.

abstractmethod get(key: bytes) bytes | None
Async:

Reads the value visible in this snapshot for key.

abstractmethod get_key_value(key: bytes) KeyValue | None
Async:

Reads the row version visible in this snapshot for key.

abstractmethod get_key_value_with_options(key: bytes, options: ReadOptions) KeyValue | None
Async:

Reads the row version visible in this snapshot for key using custom read options.

abstractmethod get_with_options(key: bytes, options: ReadOptions) bytes | None
Async:

Reads the value visible in this snapshot for key using custom read options.

abstractmethod scan(range: KeyRange) DbIterator
Async:

Scans rows inside range as of this snapshot.

abstractmethod scan_prefix(prefix: bytes) DbIterator
Async:

Scans rows whose keys start with prefix as of this snapshot.

abstractmethod scan_prefix_with_options(prefix: bytes, options: ScanOptions) DbIterator
Async:

Scans rows whose keys start with prefix as of this snapshot using custom options.

abstractmethod scan_with_options(range: KeyRange, options: ScanOptions) DbIterator
Async:

Scans rows inside range as of this snapshot using custom scan options.

class slatedb.uniffi.WriteBatch

Bases: WriteBatchProtocol

Mutable batch of write operations applied atomically by [crate::Db::write].

A batch is single-use once submitted to the database.

delete(key: bytes) None

Appends a delete operation to the batch.

merge(key: bytes, operand: bytes) None

Appends a merge operation to the batch.

merge_with_options(key: bytes, operand: bytes, options: MergeOptions) None

Appends a merge operation with custom merge options.

put(key: bytes, value: bytes) None

Appends a put operation to the batch.

put_with_options(key: bytes, value: bytes, options: PutOptions) None

Appends a put operation with custom put options.

class slatedb.uniffi.WriteBatchProtocol

Bases: Protocol

Mutable batch of write operations applied atomically by [crate::Db::write].

A batch is single-use once submitted to the database.

abstractmethod delete(key: bytes) None

Appends a delete operation to the batch.

abstractmethod merge(key: bytes, operand: bytes) None

Appends a merge operation to the batch.

abstractmethod merge_with_options(key: bytes, operand: bytes, options: MergeOptions) None

Appends a merge operation with custom merge options.

abstractmethod put(key: bytes, value: bytes) None

Appends a put operation to the batch.

abstractmethod put_with_options(key: bytes, value: bytes, options: PutOptions) None

Appends a put operation with custom put options.

class slatedb.uniffi.Db(*args, **kwargs)

Bases: DbProtocol

A writable SlateDB handle.

async begin(isolation_level: IsolationLevel) DbTransaction

Starts a transaction at the requested isolation level.

async delete(key: bytes) WriteHandle

Deletes key and returns metadata for the write.

async delete_with_options(key: bytes, options: WriteOptions) WriteHandle

Deletes key using custom write options.

async evict_cached_sst(sst_id: SsTableId) None

Best-effort eviction of block-cache entries for one SST.

If no block cache is configured, returns Ok(()).

async flush() None

Flushes the default storage layer.

async flush_with_options(options: FlushOptions) None

Flushes according to the provided flush options.

async get(key: bytes) bytes | None

Reads the current value for key.

async get_key_value(key: bytes) KeyValue | None

Reads the current row version for key, including metadata.

async get_key_value_with_options(key: bytes, options: ReadOptions) KeyValue | None

Reads the current row version for key using custom read options.

async get_with_options(key: bytes, options: ReadOptions) bytes | None

Reads the current value for key using custom read options.

async merge(key: bytes, operand: bytes) WriteHandle

Appends a merge operand for key and returns metadata for the write.

async merge_with_options(key: bytes, operand: bytes, merge_options: MergeOptions, write_options: WriteOptions) WriteHandle

Appends a merge operand using custom merge and write options.

async put(key: bytes, value: bytes) WriteHandle

Inserts or overwrites a value and returns metadata for the write.

Keys must be non-empty and at most u16::MAX bytes. Values must be at most u32::MAX bytes.

async put_with_options(key: bytes, value: bytes, put_options: PutOptions, write_options: WriteOptions) WriteHandle

Inserts or overwrites a value using custom put and write options.

async scan(range: KeyRange) DbIterator

Scans rows inside range.

async scan_prefix(prefix: bytes) DbIterator

Scans rows whose keys start with prefix.

async scan_prefix_with_options(prefix: bytes, options: ScanOptions) DbIterator

Scans rows whose keys start with prefix using custom scan options.

async scan_with_options(range: KeyRange, options: ScanOptions) DbIterator

Scans rows inside range using custom scan options.

async shutdown() None

Flushes outstanding work and closes the database.

async snapshot() DbSnapshot

Creates a read-only snapshot representing a consistent point in time.

status() DbStatus

Returns the latest database status snapshot.

async warm_sst(sst_id: SsTableId, targets: List[CacheTarget]) None

Warms selected cache content for one SST.

Returns Err on the first failing target. If no block cache is configured, or if the SST is not reachable from the current manifest, the call is a no-op that returns Ok(()).

async write(batch: WriteBatch) WriteHandle

Applies all operations in batch atomically.

The provided batch is consumed and cannot be reused afterwards.

async write_with_options(batch: WriteBatch, options: WriteOptions) WriteHandle

Applies all operations in batch atomically using custom write options.

The provided batch is consumed and cannot be reused afterwards.

class slatedb.uniffi.DbProtocol

Bases: Protocol

A writable SlateDB handle.

abstractmethod begin(isolation_level: IsolationLevel) DbTransaction
Async:

Starts a transaction at the requested isolation level.

abstractmethod delete(key: bytes) WriteHandle
Async:

Deletes key and returns metadata for the write.

abstractmethod delete_with_options(key: bytes, options: WriteOptions) WriteHandle
Async:

Deletes key using custom write options.

abstractmethod evict_cached_sst(sst_id: SsTableId) None
Async:

Best-effort eviction of block-cache entries for one SST.

If no block cache is configured, returns Ok(()).

abstractmethod flush() None
Async:

Flushes the default storage layer.

abstractmethod flush_with_options(options: FlushOptions) None
Async:

Flushes according to the provided flush options.

abstractmethod get(key: bytes) bytes | None
Async:

Reads the current value for key.

abstractmethod get_key_value(key: bytes) KeyValue | None
Async:

Reads the current row version for key, including metadata.

abstractmethod get_key_value_with_options(key: bytes, options: ReadOptions) KeyValue | None
Async:

Reads the current row version for key using custom read options.

abstractmethod get_with_options(key: bytes, options: ReadOptions) bytes | None
Async:

Reads the current value for key using custom read options.

abstractmethod merge(key: bytes, operand: bytes) WriteHandle
Async:

Appends a merge operand for key and returns metadata for the write.

abstractmethod merge_with_options(key: bytes, operand: bytes, merge_options: MergeOptions, write_options: WriteOptions) WriteHandle
Async:

Appends a merge operand using custom merge and write options.

abstractmethod put(key: bytes, value: bytes) WriteHandle
Async:

Inserts or overwrites a value and returns metadata for the write.

Keys must be non-empty and at most u16::MAX bytes. Values must be at most u32::MAX bytes.

abstractmethod put_with_options(key: bytes, value: bytes, put_options: PutOptions, write_options: WriteOptions) WriteHandle
Async:

Inserts or overwrites a value using custom put and write options.

abstractmethod scan(range: KeyRange) DbIterator
Async:

Scans rows inside range.

abstractmethod scan_prefix(prefix: bytes) DbIterator
Async:

Scans rows whose keys start with prefix.

abstractmethod scan_prefix_with_options(prefix: bytes, options: ScanOptions) DbIterator
Async:

Scans rows whose keys start with prefix using custom scan options.

abstractmethod scan_with_options(range: KeyRange, options: ScanOptions) DbIterator
Async:

Scans rows inside range using custom scan options.

abstractmethod shutdown() None
Async:

Flushes outstanding work and closes the database.

abstractmethod snapshot() DbSnapshot
Async:

Creates a read-only snapshot representing a consistent point in time.

abstractmethod status() DbStatus

Returns the latest database status snapshot.

abstractmethod warm_sst(sst_id: SsTableId, targets: List[CacheTarget]) None
Async:

Warms selected cache content for one SST.

Returns Err on the first failing target. If no block cache is configured, or if the SST is not reachable from the current manifest, the call is a no-op that returns Ok(()).

abstractmethod write(batch: WriteBatch) WriteHandle
Async:

Applies all operations in batch atomically.

The provided batch is consumed and cannot be reused afterwards.

abstractmethod write_with_options(batch: WriteBatch, options: WriteOptions) WriteHandle
Async:

Applies all operations in batch atomically using custom write options.

The provided batch is consumed and cannot be reused afterwards.

class slatedb.uniffi.DbCache(*args, **kwargs)

Bases: DbCacheProtocol

Database cache used to store blocks in memory.

classmethod new_foyer_cache(options: FoyerCacheOptions) DbCache

Creates a new Foyer based DB cache.

classmethod new_moka_cache(options: MokaCacheOptions) DbCache

Creates a new Moka based DB cache.

classmethod new_split_cache(block_cache: DbCache, meta_cache: DbCache) DbCache

Creates a new split cache with separate block and metadata capacities.

class slatedb.uniffi.DbCacheProtocol

Bases: Protocol

Database cache used to store blocks in memory.

class slatedb.uniffi.FilterPolicy(*args, **kwargs)

Bases: FilterPolicyProtocol

A filter policy used to build and read SST filters.

Construct one with [FilterPolicy::bloom] or [FilterPolicy::bloom_with_options] for the built-in bloom filter.

classmethod bloom(bits_per_key: int) FilterPolicy

Constructs a bloom filter policy with the given bits per key, whole-key filtering enabled, and no prefix extractor.

classmethod bloom_with_options(options: BloomFilterOptions, prefix_extractor: PrefixExtractor | None) FilterPolicy

Constructs a bloom filter policy from the supplied options, with an optional prefix extractor enabling prefix-based bloom filtering.

name() str

Returns the policy name encoded into SSTs that use this policy.

class slatedb.uniffi.FilterPolicyProtocol

Bases: Protocol

A filter policy used to build and read SST filters.

Construct one with [FilterPolicy::bloom] or [FilterPolicy::bloom_with_options] for the built-in bloom filter.

abstractmethod name() str

Returns the policy name encoded into SSTs that use this policy.

class slatedb.uniffi.MergeOperatorImpl(*args, **kwargs)

Bases: MergeOperator

Application-provided merge operator used by merge-enabled databases.

merge(key: bytes, existing_value: bytes | None, operand: bytes) bytes

Combines an existing value and a new merge operand into the next value.

existing_value is None when the key has no visible base value.

class slatedb.uniffi.MergeOperator

Application-provided merge operator used by merge-enabled databases.

abstractmethod merge(key: bytes, existing_value: bytes | None, operand: bytes) bytes

Combines an existing value and a new merge operand into the next value.

existing_value is None when the key has no visible base value.

class slatedb.uniffi.GaugeImpl(*args, **kwargs)

Bases: Gauge

Handle for a gauge metric.

set(value: int) None

Sets the gauge to value.

class slatedb.uniffi.Gauge

Handle for a gauge metric.

abstractmethod set(value: int) None

Sets the gauge to value.

class slatedb.uniffi.UpDownCounterImpl(*args, **kwargs)

Bases: UpDownCounter

Handle for an up/down counter metric.

increment(value: int) None

Adds value to the counter.

class slatedb.uniffi.UpDownCounter

Handle for an up/down counter metric.

abstractmethod increment(value: int) None

Adds value to the counter.

class slatedb.uniffi.HistogramImpl(*args, **kwargs)

Bases: Histogram

Handle for a histogram metric.

record(value: float) None

Records value in the histogram.

class slatedb.uniffi.Histogram

Handle for a histogram metric.

abstractmethod record(value: float) None

Records value in the histogram.

class slatedb.uniffi.MetricsRecorderImpl(*args, **kwargs)

Bases: MetricsRecorder

Application-defined metrics recorder used to publish SlateDB metrics.

register_counter(name: str, description: str | None, labels: List[MetricLabel]) Counter

Registers a monotonically increasing counter.

register_gauge(name: str, description: str | None, labels: List[MetricLabel]) Gauge

Registers a gauge.

register_up_down_counter(name: str, description: str | None, labels: List[MetricLabel]) UpDownCounter

Registers an up/down counter.

register_histogram(name: str, description: str | None, labels: List[MetricLabel], boundaries: List[float]) Histogram

Registers a histogram with explicit bucket boundaries.

class slatedb.uniffi.MetricsRecorder

Application-defined metrics recorder used to publish SlateDB metrics.

abstractmethod register_counter(name: str, description: str | None, labels: List[MetricLabel]) Counter

Registers a monotonically increasing counter.

abstractmethod register_gauge(name: str, description: str | None, labels: List[MetricLabel]) Gauge

Registers a gauge.

abstractmethod register_up_down_counter(name: str, description: str | None, labels: List[MetricLabel]) UpDownCounter

Registers an up/down counter.

abstractmethod register_histogram(name: str, description: str | None, labels: List[MetricLabel], boundaries: List[float]) Histogram

Registers a histogram with explicit bucket boundaries.

class slatedb.uniffi.Settings(*args, **kwargs)

Bases: SettingsProtocol

Mutable database settings object used to configure a [crate::DbBuilder].

classmethod default() Settings

Creates a settings object populated with SlateDB defaults.

classmethod from_env(prefix: str) Settings

Loads settings from environment variables using prefix.

classmethod from_env_with_default(prefix: str, default_settings: Settings) Settings

Loads settings from environment variables, falling back to default_settings.

classmethod from_file(path: str) Settings

Loads settings from a JSON, TOML, or YAML file based on its extension.

classmethod from_json_string(json: str) Settings

Parses settings from a JSON string.

classmethod load() Settings

Loads settings from SlateDB’s default file and environment lookup order.

set(key: str, value_json: str) None

Sets a settings field by dotted path using a JSON literal value.

key identifies the field to update. Use . to address nested objects, for example compactor_options.max_sst_size or object_store_cache_options.root_folder.

value_json must be a valid JSON literal matching the target field’s expected type. That means strings must be quoted JSON strings, numbers should be passed as JSON numbers, booleans as true/false, and optional fields can be cleared with null.

Missing or null intermediate objects in the dotted path are created automatically. If the update would produce an invalid slatedb::Settings value, the method returns an error and leaves the current settings unchanged.

Examples:

  • set(“flush_interval”, “”250ms””)

  • set(“default_ttl”, “42”)

  • set(“default_ttl”, “null”)

  • set(“compactor_options.max_sst_size”, “33554432”)

  • set(“object_store_cache_options.root_folder”, “”/tmp/slatedb-cache””)

to_json_string() str

Serializes the current settings value to a JSON string.

class slatedb.uniffi.SettingsProtocol

Bases: Protocol

Mutable database settings object used to configure a [crate::DbBuilder].

abstractmethod set(key: str, value_json: str) None

Sets a settings field by dotted path using a JSON literal value.

key identifies the field to update. Use . to address nested objects, for example compactor_options.max_sst_size or object_store_cache_options.root_folder.

value_json must be a valid JSON literal matching the target field’s expected type. That means strings must be quoted JSON strings, numbers should be passed as JSON numbers, booleans as true/false, and optional fields can be cleared with null.

Missing or null intermediate objects in the dotted path are created automatically. If the update would produce an invalid slatedb::Settings value, the method returns an error and leaves the current settings unchanged.

Examples:

  • set(“flush_interval”, “”250ms””)

  • set(“default_ttl”, “42”)

  • set(“default_ttl”, “null”)

  • set(“compactor_options.max_sst_size”, “33554432”)

  • set(“object_store_cache_options.root_folder”, “”/tmp/slatedb-cache””)

abstractmethod to_json_string() str

Serializes the current settings value to a JSON string.

class slatedb.uniffi.DbBuilder(path: str, object_store: ObjectStore)

Bases: DbBuilderProtocol

Builder for opening a writable [crate::Db].

Builders are single-use: calling [DbBuilder::build] consumes the builder.

async build() Db

Opens the database and consumes this builder.

with_db_cache(db_cache: DbCache) None

Sets DB cache.

with_db_cache_disabled() None

Disables the SST block and metadata cache.

with_filter_policies(policies: List[FilterPolicy]) None

Sets the filter policies used for SST filter construction and evaluation.

Pass an empty vec to disable filters entirely. When unset, the default is a single bloom filter with 10 bits per key.

with_merge_operator(merge_operator: MergeOperator) None

Installs an application-defined merge operator.

with_metrics_recorder(metrics_recorder: MetricsRecorder) None

Installs an application-defined metrics recorder.

with_seed(seed: int) None

Sets the seed used for SlateDB’s internal random number generation.

with_settings(settings: Settings) None

Applies a [crate::Settings] object to the builder.

with_sst_block_size(sst_block_size: SstBlockSize) None

Sets the SSTable block size used for newly written tables.

with_wal_object_store(wal_object_store: ObjectStore) None

Uses a separate object store for WAL files.

class slatedb.uniffi.DbBuilderProtocol

Bases: Protocol

Builder for opening a writable [crate::Db].

Builders are single-use: calling [DbBuilder::build] consumes the builder.

abstractmethod build() Db
Async:

Opens the database and consumes this builder.

abstractmethod with_db_cache(db_cache: DbCache) None

Sets DB cache.

abstractmethod with_db_cache_disabled() None

Disables the SST block and metadata cache.

abstractmethod with_filter_policies(policies: List[FilterPolicy]) None

Sets the filter policies used for SST filter construction and evaluation.

Pass an empty vec to disable filters entirely. When unset, the default is a single bloom filter with 10 bits per key.

abstractmethod with_merge_operator(merge_operator: MergeOperator) None

Installs an application-defined merge operator.

abstractmethod with_metrics_recorder(metrics_recorder: MetricsRecorder) None

Installs an application-defined metrics recorder.

abstractmethod with_seed(seed: int) None

Sets the seed used for SlateDB’s internal random number generation.

abstractmethod with_settings(settings: Settings) None

Applies a [crate::Settings] object to the builder.

abstractmethod with_sst_block_size(sst_block_size: SstBlockSize) None

Sets the SSTable block size used for newly written tables.

abstractmethod with_wal_object_store(wal_object_store: ObjectStore) None

Uses a separate object store for WAL files.

class slatedb.uniffi.DbReader(*args, **kwargs)

Bases: DbReaderProtocol

Read-only database handle opened by [crate::DbReaderBuilder].

async evict_cached_sst(sst_id: SsTableId) None

Best-effort eviction of block-cache entries for one SST.

If no block cache is configured, returns Ok(()).

async get(key: bytes) bytes | None

Reads the current value for key.

async get_key_value(key: bytes) KeyValue | None

Reads the current row version for key, including metadata.

async get_key_value_with_options(key: bytes, options: ReadOptions) KeyValue | None

Reads the current row version for key using custom read options.

async get_with_options(key: bytes, options: ReadOptions) bytes | None

Reads the current value for key using custom read options.

async scan(range: KeyRange) DbIterator

Scans rows inside range.

async scan_prefix(prefix: bytes) DbIterator

Scans rows whose keys start with prefix.

async scan_prefix_with_options(prefix: bytes, options: ScanOptions) DbIterator

Scans rows whose keys start with prefix using custom scan options.

async scan_with_options(range: KeyRange, options: ScanOptions) DbIterator

Scans rows inside range using custom scan options.

async shutdown() None

Closes the reader.

status() DbStatus

Returns the latest reader status snapshot.

async warm_sst(sst_id: SsTableId, targets: List[CacheTarget]) None

Warms selected cache content for one SST.

Returns Err on the first failing target. If no block cache is configured, or if the SST is not reachable from the current manifest, the call is a no-op that returns Ok(()).

class slatedb.uniffi.DbReaderProtocol

Bases: Protocol

Read-only database handle opened by [crate::DbReaderBuilder].

abstractmethod evict_cached_sst(sst_id: SsTableId) None
Async:

Best-effort eviction of block-cache entries for one SST.

If no block cache is configured, returns Ok(()).

abstractmethod get(key: bytes) bytes | None
Async:

Reads the current value for key.

abstractmethod get_key_value(key: bytes) KeyValue | None
Async:

Reads the current row version for key, including metadata.

abstractmethod get_key_value_with_options(key: bytes, options: ReadOptions) KeyValue | None
Async:

Reads the current row version for key using custom read options.

abstractmethod get_with_options(key: bytes, options: ReadOptions) bytes | None
Async:

Reads the current value for key using custom read options.

abstractmethod scan(range: KeyRange) DbIterator
Async:

Scans rows inside range.

abstractmethod scan_prefix(prefix: bytes) DbIterator
Async:

Scans rows whose keys start with prefix.

abstractmethod scan_prefix_with_options(prefix: bytes, options: ScanOptions) DbIterator
Async:

Scans rows whose keys start with prefix using custom scan options.

abstractmethod scan_with_options(range: KeyRange, options: ScanOptions) DbIterator
Async:

Scans rows inside range using custom scan options.

abstractmethod shutdown() None
Async:

Closes the reader.

abstractmethod status() DbStatus

Returns the latest reader status snapshot.

abstractmethod warm_sst(sst_id: SsTableId, targets: List[CacheTarget]) None
Async:

Warms selected cache content for one SST.

Returns Err on the first failing target. If no block cache is configured, or if the SST is not reachable from the current manifest, the call is a no-op that returns Ok(()).

class slatedb.uniffi.DbReaderBuilder(path: str, object_store: ObjectStore)

Bases: DbReaderBuilderProtocol

Builder for opening a read-only [crate::DbReader].

Builders are single-use: calling [DbReaderBuilder::build] consumes the builder.

async build() DbReader

Opens the reader and consumes this builder.

with_checkpoint_id(checkpoint_id: str) None

Pins the reader to an existing checkpoint UUID string.

with_filter_policies(policies: List[FilterPolicy]) None

Sets the filter policies used when decoding SST filter blocks.

Must match (or be a superset of) the writer’s policies so SST filter sub-blocks can be decoded; unrecognized policy names are silently skipped. Defaults to a single bloom filter with 10 bits per key.

with_merge_operator(merge_operator: MergeOperator) None

Installs an application-defined merge operator used while reading merge rows.

with_metrics_recorder(metrics_recorder: MetricsRecorder) None

Installs an application-defined metrics recorder.

with_options(options: ReaderOptions) None

Applies custom reader options.

with_wal_object_store(wal_object_store: ObjectStore) None

Uses a separate object store for WAL files.

class slatedb.uniffi.DbReaderBuilderProtocol

Bases: Protocol

Builder for opening a read-only [crate::DbReader].

Builders are single-use: calling [DbReaderBuilder::build] consumes the builder.

abstractmethod build() DbReader
Async:

Opens the reader and consumes this builder.

abstractmethod with_checkpoint_id(checkpoint_id: str) None

Pins the reader to an existing checkpoint UUID string.

abstractmethod with_filter_policies(policies: List[FilterPolicy]) None

Sets the filter policies used when decoding SST filter blocks.

Must match (or be a superset of) the writer’s policies so SST filter sub-blocks can be decoded; unrecognized policy names are silently skipped. Defaults to a single bloom filter with 10 bits per key.

abstractmethod with_merge_operator(merge_operator: MergeOperator) None

Installs an application-defined merge operator used while reading merge rows.

abstractmethod with_metrics_recorder(metrics_recorder: MetricsRecorder) None

Installs an application-defined metrics recorder.

abstractmethod with_options(options: ReaderOptions) None

Applies custom reader options.

abstractmethod with_wal_object_store(wal_object_store: ObjectStore) None

Uses a separate object store for WAL files.

class slatedb.uniffi.DefaultMetricsRecorder

Bases: DefaultMetricsRecorderProtocol, MetricsRecorder

Built-in atomic-backed metrics recorder with snapshot access.

metric_by_name_and_labels(name: str, labels: List[MetricLabel]) Metric | None

Returns the metric matching name and the exact label set, if present.

metrics_by_name(name: str) List[Metric]

Returns every metric with the requested name.

register_counter(name: str, description: str | None, labels: List[MetricLabel]) Counter

Registers a monotonically increasing counter.

register_gauge(name: str, description: str | None, labels: List[MetricLabel]) Gauge

Registers a gauge.

register_histogram(name: str, description: str | None, labels: List[MetricLabel], boundaries: List[float]) Histogram

Registers a histogram with explicit bucket boundaries.

register_up_down_counter(name: str, description: str | None, labels: List[MetricLabel]) UpDownCounter

Registers an up/down counter.

snapshot() List[Metric]

Returns a point-in-time snapshot of every registered metric.

class slatedb.uniffi.DefaultMetricsRecorderProtocol

Bases: Protocol

Built-in atomic-backed metrics recorder with snapshot access.

abstractmethod metric_by_name_and_labels(name: str, labels: List[MetricLabel]) Metric | None

Returns the metric matching name and the exact label set, if present.

abstractmethod metrics_by_name(name: str) List[Metric]

Returns every metric with the requested name.

abstractmethod register_counter(name: str, description: str | None, labels: List[MetricLabel]) Counter
abstractmethod register_gauge(name: str, description: str | None, labels: List[MetricLabel]) Gauge
abstractmethod register_histogram(name: str, description: str | None, labels: List[MetricLabel], boundaries: List[float]) Histogram
abstractmethod register_up_down_counter(name: str, description: str | None, labels: List[MetricLabel]) UpDownCounter
abstractmethod snapshot() List[Metric]

Returns a point-in-time snapshot of every registered metric.

class slatedb.uniffi.LogCallbackImpl(*args, **kwargs)

Bases: LogCallback

Callback invoked for each emitted log record.

log(record: LogRecord) None

Handles one log record.

class slatedb.uniffi.LogCallback

Callback invoked for each emitted log record.

abstractmethod log(record: LogRecord) None

Handles one log record.

class slatedb.uniffi.PrefixExtractorImpl(*args, **kwargs)

Bases: PrefixExtractor

Application-provided prefix extractor used to configure prefix-based bloom filters.

name() str

Stable identifier for this extractor’s configuration. Included in the bloom filter policy name so filters built with different extractors are never mismatched.

prefix_len(target: PrefixTarget) int | None

Returns the prefix length to use for target, or None when no prefix is extractable.

class slatedb.uniffi.PrefixExtractor

Application-provided prefix extractor used to configure prefix-based bloom filters.

abstractmethod name() str

Stable identifier for this extractor’s configuration. Included in the bloom filter policy name so filters built with different extractors are never mismatched.

abstractmethod prefix_len(target: PrefixTarget) int | None

Returns the prefix length to use for target, or None when no prefix is extractable.

class slatedb.uniffi.WalFileIterator(*args, **kwargs)

Bases: WalFileIteratorProtocol

Iterator over raw row entries stored in a WAL file.

async next() RowEntry | None

Returns the next raw row entry from the WAL file.

class slatedb.uniffi.WalFileIteratorProtocol

Bases: Protocol

Iterator over raw row entries stored in a WAL file.

abstractmethod next() RowEntry | None
Async:

Returns the next raw row entry from the WAL file.

class slatedb.uniffi.WalFile(*args, **kwargs)

Bases: WalFileProtocol

Handle for a single WAL file.

id() int

Returns the WAL file ID.

async iterator() WalFileIterator

Opens an iterator over raw row entries in this WAL file.

async metadata() WalFileMetadata

Reads object-store metadata for this WAL file.

next_file() WalFile

Returns a handle for the next WAL file ID without checking existence.

next_id() int

Returns the WAL ID immediately after this file.

class slatedb.uniffi.WalFileProtocol

Bases: Protocol

Handle for a single WAL file.

abstractmethod id() int

Returns the WAL file ID.

abstractmethod iterator() WalFileIterator
Async:

Opens an iterator over raw row entries in this WAL file.

abstractmethod metadata() WalFileMetadata
Async:

Reads object-store metadata for this WAL file.

abstractmethod next_file() WalFile

Returns a handle for the next WAL file ID without checking existence.

abstractmethod next_id() int

Returns the WAL ID immediately after this file.

class slatedb.uniffi.WalReader(path: str, object_store: ObjectStore)

Bases: WalReaderProtocol

Reader for WAL files stored under a database path.

get(id: int) WalFile

Returns a handle for the WAL file with the given ID.

async list(start_id: int | None, end_id: int | None) List[WalFile]

Lists WAL files in ascending ID order.

start_id is inclusive and end_id is exclusive when provided.

class slatedb.uniffi.WalReaderProtocol

Bases: Protocol

Reader for WAL files stored under a database path.

abstractmethod get(id: int) WalFile

Returns a handle for the WAL file with the given ID.

abstractmethod list(start_id: int | None, end_id: int | None) List[WalFile]
Async:

Lists WAL files in ascending ID order.

start_id is inclusive and end_id is exclusive when provided.