Skip to main content

Storage

Struct Storage 

Source
pub struct Storage { /* private fields */ }
Expand description

Low-level SQLite storage layer.

Manages the SQLite connection, metadata tables, and per-DynamoDB-table data tables. All SQL lives here: higher layers work with Rust types.

Native-only: this type is the rusqlite-backed backend and is compiled out of backend-neutral builds (for example wasm-sqlite).

Implementations§

Source§

impl Storage

Source

pub fn new(path: &str) -> Result<Self>

Open a persistent database at the given path.

Source

pub fn with_clock(self, clock: Arc<dyn Clock>) -> Self

Replace the Clock used by the stream and TTL paths. Returns self so callers can chain construction (Storage::memory()?.with_clock(c)).

Default for every constructor is SystemClock. Tests use this to inject a ManualClock.

Source

pub fn memory() -> Result<Self>

Open an in-memory database (for tests and ephemeral use).

Source

pub fn conn(&self) -> &Connection

Get a reference to the underlying connection (for transactions, etc.).

Source

pub fn conn_mut(&mut self) -> &mut Connection

Get a mutable reference to the underlying connection.

Source

pub fn insert_table_metadata(&self, m: &CreateTableMetadata<'_>) -> Result<()>

Insert a row into the _tables metadata table.

Source

pub fn get_table_metadata( &self, table_name: &str, ) -> Result<Option<TableMetadata>>

Get metadata for a table. Returns None if the table doesn’t exist.

Results are cached in memory. The cache is invalidated when metadata is modified via insert_table_metadata, delete_table_metadata, enable_stream, or update_ttl_config.

Source

pub fn delete_table_metadata(&self, table_name: &str) -> Result<bool>

Delete metadata for a table.

Source

pub fn update_table_metadata( &self, table_name: &str, attribute_definitions: &str, gsi_definitions: Option<&str>, ) -> Result<()>

Update attribute definitions and GSI definitions for a table.

Source

pub fn update_vector_index_definitions( &self, table_name: &str, vector_index_definitions: Option<&str>, ) -> Result<()>

Update vector index definitions for a table; None clears the column.

Source

pub fn update_provisioned_throughput( &self, table_name: &str, provisioned_throughput: &str, ) -> Result<()>

Update provisioned throughput for a table.

Source

pub fn clear_provisioned_throughput(&self, table_name: &str) -> Result<()>

Clear provisioned throughput for a table (sets to SQL NULL).

Source

pub fn clear_on_demand_throughput(&self, table_name: &str) -> Result<()>

Clear on-demand throughput ceilings for a table (sets to SQL NULL).

Source

pub fn update_billing_mode( &self, table_name: &str, billing_mode: &str, ) -> Result<()>

Update billing mode for a table.

Source

pub fn update_table_class( &self, table_name: &str, table_class: &str, ) -> Result<()>

Update the table class for a table.

Source

pub fn update_on_demand_throughput( &self, table_name: &str, on_demand_throughput: &str, ) -> Result<()>

Update the on-demand throughput (stored as JSON) for a table.

Source

pub fn get_tags(&self, table_name: &str) -> Result<Vec<Tag>>

Get tags for a table.

Source

pub fn set_tags(&self, table_name: &str, new_tags: &[Tag]) -> Result<()>

Set (merge) tags on a table. New keys overwrite existing keys.

Source

pub fn update_deletion_protection( &self, table_name: &str, enabled: bool, ) -> Result<()>

Update the deletion protection setting for a table.

Source

pub fn remove_tags(&self, table_name: &str, keys: &[String]) -> Result<()>

Remove tags by key from a table.

Source

pub fn list_table_names(&self) -> Result<Vec<String>>

List all table names.

Source

pub fn table_exists(&self, table_name: &str) -> Result<bool>

Check if a table exists in metadata.

Source

pub fn create_data_table(&self, table_name: &str) -> Result<()>

Create a data table for a DynamoDB table.

Source

pub fn drop_data_table(&self, table_name: &str) -> Result<()>

Drop a data table.

Source

pub fn create_gsi_table(&self, table_name: &str, index_name: &str) -> Result<()>

Create a GSI table.

Source

pub fn drop_gsi_table(&self, table_name: &str, index_name: &str) -> Result<()>

Drop a GSI table.

Source

pub fn insert_gsi_item( &self, table_name: &str, index_name: &str, gsi_pk: &str, gsi_sk: &str, table_pk: &str, table_sk: &str, item_json: &str, ) -> Result<()>

Insert an item into a GSI table.

Source

pub fn insert_gsi_items( &self, table_name: &str, index_name: &str, rows: &[GsiItemRow], ) -> Result<()>

Bulk-insert many rows into one GSI table using a single cached prepared statement. Equivalent to calling Self::insert_gsi_item once per row, but reuses the statement across the batch.

Source

pub fn delete_gsi_item( &self, table_name: &str, index_name: &str, table_pk: &str, table_sk: &str, ) -> Result<()>

Delete an item from a GSI table by base table primary key.

Source

pub fn query_gsi_items( &self, table_name: &str, index_name: &str, gsi_pk: &str, params: &QueryParams<'_>, ) -> Result<Vec<(String, String, String)>>

Query items from a GSI table.

Source

pub fn scan_gsi_items( &self, table_name: &str, index_name: &str, params: &ScanParams<'_>, ) -> Result<Vec<(String, String, String)>>

Scan all items from a GSI table.

Source

pub fn create_lsi_table(&self, table_name: &str, index_name: &str) -> Result<()>

Create an LSI table for a given base table and index name.

Source

pub fn create_vector_table( &self, table_name: &str, index_name: &str, ) -> Result<()>

Create a vector index shadow table.

Source

pub fn insert_vector_items( &self, table_name: &str, index_name: &str, rows: &[VectorItemRow], ) -> Result<()>

Bulk-insert many rows into one vector shadow table using a single cached prepared statement, mirroring Self::insert_gsi_items.

Source

pub fn delete_vector_item( &self, table_name: &str, index_name: &str, table_pk: &str, table_sk: &str, ) -> Result<()>

Delete a vector shadow-table row by base table primary key, mirroring Self::delete_gsi_item.

Source

pub fn query_vector_candidates( &self, table_name: &str, index_name: &str, hash_value: Option<&str>, ) -> Result<Vec<VectorCandidateRow>>

Load vector shadow-table candidate rows for a search, optionally scoped to one SearchSchema HASH value. Ordered by base-table primary key (see the builder) so equal scores tie-break deterministically.

Source

pub fn vector_items_for_keys( &self, table_name: &str, index_name: &str, keys: &[(String, String)], ) -> Result<Vec<(String, String, String)>>

Load the projected entries for the keys a search returns.

Source

pub fn drop_vector_table( &self, table_name: &str, index_name: &str, ) -> Result<()>

Drop a vector index shadow table.

Source

pub fn drop_lsi_table(&self, table_name: &str, index_name: &str) -> Result<()>

Drop an LSI table.

Source

pub fn insert_lsi_item( &self, table_name: &str, index_name: &str, pk: &str, sk: &str, base_pk: &str, base_sk: &str, item_json: &str, ) -> Result<()>

Insert an item into an LSI table.

Source

pub fn delete_lsi_item( &self, table_name: &str, index_name: &str, base_pk: &str, base_sk: &str, ) -> Result<()>

Delete an item from an LSI table by base table primary key.

Source

pub fn query_lsi_items( &self, table_name: &str, index_name: &str, pk: &str, params: &QueryParams<'_>, ) -> Result<Vec<(String, String, String)>>

Query items from an LSI table.

Source

pub fn scan_lsi_items( &self, table_name: &str, index_name: &str, params: &ScanParams<'_>, ) -> Result<Vec<(String, String, String)>>

Scan all items from an LSI table.

Source

pub fn begin_transaction(&self) -> Result<()>

Begin an immediate SQLite transaction.

Source

pub fn commit(&self) -> Result<()>

Commit the current transaction.

Source

pub fn rollback(&self) -> Result<()>

Rollback the current transaction.

Source

pub fn enable_bulk_loading(&self) -> Result<()>

Set aggressive PRAGMAs for bulk loading.

Disables fsync, increases cache, and enables memory-mapped I/O. Only safe when data loss on crash is acceptable (e.g., fresh import that can be re-run).

Source

pub fn disable_bulk_loading(&self) -> Result<()>

Restore normal PRAGMAs after bulk loading.

Source

pub fn put_item( &self, table_name: &str, pk: &str, sk: &str, item_json: &str, item_size: usize, ) -> Result<Option<String>>

Insert or replace an item.

Source

pub fn put_item_with_hash( &self, table_name: &str, pk: &str, sk: &str, item_json: &str, item_size: usize, hash_prefix: &str, ) -> Result<Option<String>>

Put an item with an explicit hash prefix for parallel scan ordering.

Source

pub fn put_base_items( &self, table_name: &str, rows: &[BaseItemRow], ) -> Result<()>

Bulk-insert many base-table rows using a single cached prepared statement (INSERT OR REPLACE). Unlike Self::put_item_with_hash, which preserves any existing cached_at, this writes cached_at verbatim from each row, matching the import flow’s semantics.

Source

pub fn get_item( &self, table_name: &str, pk: &str, sk: &str, ) -> Result<Option<String>>

Get a single item by primary key.

Source

pub fn get_partition_size(&self, table_name: &str, pk: &str) -> Result<i64>

Return the total item_size for all items sharing the given partition key.

Source

pub fn get_lsi_partition_size( &self, table_name: &str, index_name: &str, pk: &str, ) -> Result<i64>

Return the total size of LSI items for a given partition key. LSI items are stored as JSON text, so we use length(item_json).

Source

pub fn delete_item( &self, table_name: &str, pk: &str, sk: &str, ) -> Result<Option<String>>

Delete an item by primary key. Returns the old item_json if it existed.

Source

pub fn query_items( &self, table_name: &str, pk: &str, params: &QueryParams<'_>, ) -> Result<Vec<(String, String, String)>>

Query items by partition key with optional sort key condition.

sk_condition is a SQL fragment like AND sk > ? with sk_params providing values. Returns (items, has_more) where items is a vec of (pk, sk, item_json).

Source

pub fn scan_items( &self, table_name: &str, params: &ScanParams<'_>, ) -> Result<Vec<(String, String, String)>>

Scan items from a table with pagination.

Returns (pk, sk, item_json) tuples ordered by hash_prefix for dynalite-compatible parallel scan behaviour.

Source

pub fn count_items(&self, table_name: &str) -> Result<i64>

Count items in a table.

Source

pub fn item_count_and_size(&self, table_name: &str) -> Result<(i64, i64)>

Count items in a table and total their stored sizes, in one query.

Source

pub fn gsi_item_count_and_size( &self, table_name: &str, index_name: &str, whole_items: bool, ) -> Result<(i64, i64)>

Count a GSI’s entries and total their projected sizes. See StorageBackend::gsi_item_count_and_size.

Source

pub fn lsi_item_count_and_size( &self, table_name: &str, index_name: &str, whole_items: bool, ) -> Result<(i64, i64)>

Count an LSI’s entries and total their projected sizes. See StorageBackend::lsi_item_count_and_size.

Source

pub fn vector_item_count_and_size( &self, table_name: &str, index_name: &str, ) -> Result<(i64, i64)>

Count a vector index’s entries and total their stored billable sizes. See StorageBackend::vector_item_count_and_size.

Source

pub fn set_item_sizes( &self, table_name: &str, sizes: &[(String, String, usize)], ) -> Result<()>

Rewrite the stored item_size of the given rows. See StorageBackend::set_item_sizes.

Source

pub fn db_path(&self) -> Option<String>

Get the database file path, or None for in-memory databases.

Source

pub fn db_size_bytes(&self) -> Result<u64>

Get the total database size in bytes.

Source

pub fn table_count(&self) -> Result<usize>

Count the number of DynamoDB tables.

Source

pub fn table_stats(&self) -> Result<Vec<TableStats>>

Get per-table statistics: name, item count, and approximate size in bytes.

Uses a single query per table (COUNT + SUM combined) instead of separate queries.

Source

pub fn database_info(&self) -> Result<DatabaseInfo>

Get combined database info in a single call for atomic consistency.

Returns all introspection data that get_database_info tools need without releasing the lock between queries.

Source

pub fn vacuum_into(&self, path: &str) -> Result<()>

Create a snapshot of the database by copying it to the given path. Uses VACUUM INTO which works for both in-memory and file-backed databases.

Source

pub fn vacuum(&self) -> Result<()>

Run VACUUM to compact the database file in place.

Source

pub fn restore_from(&mut self, path: &str) -> Result<()>

Restore the database from a snapshot file using SQLite’s backup API. This replaces the current database contents with the snapshot contents. Works for both in-memory and file-backed databases.

The snapshot is opened read-only, so it is never written to. A snapshot in WAL mode (every file Dynoxide creates is) may be left with its -wal and -shm files beside it afterwards, as reading a WAL database creates them and a read-only connection can’t remove them on close.

Source

pub fn backup_to_memory(&self) -> Result<Connection>

Backup the current database to a new in-memory SQLite connection.

Used for in-memory snapshot storage: the returned connection holds a complete copy of the database without touching the filesystem.

Source

pub fn restore_from_connection(&mut self, source: &Connection) -> Result<()>

Restore the database from another SQLite connection using the backup API.

A source with no Dynoxide metadata (an empty or zero-byte file, :memory:, or another program’s database) is refused as not a snapshot. Otherwise the source is copied into a private temporary database and brought up to date there, as an open would bring a file an earlier build wrote; only then does the copy replace this database’s contents and the metadata cache get cleared. A copy or migration that fails leaves this database as it was. SQLite keeps the temporary copy in its page cache and spills it to a temporary file as it grows, so a large snapshot doesn’t need its own size in memory. Builds with encryption are the exception: SQLCipher is compiled to keep temporary databases in memory (SQLITE_TEMP_STORE=2), so there the copy does take its own size in memory, and never reaches the disk unencrypted.

Source

pub fn connection_size_bytes(conn: &Connection) -> Result<u64>

Get the database size in bytes for an arbitrary connection.

Source

pub fn enable_stream( &self, table_name: &str, view_type: &str, label: &str, ) -> Result<()>

Enable streams on a table.

Source

pub fn disable_stream(&self, table_name: &str) -> Result<()>

Disable streams on a table.

Source

pub fn insert_stream_record( &self, table_name: &str, event_name: &str, keys_json: &str, new_image: Option<&str>, old_image: Option<&str>, sequence_number: &str, shard_id: &str, created_at: i64, ) -> Result<()>

Insert a stream record.

Source

pub fn insert_stream_record_with_identity( &self, table_name: &str, event_name: &str, keys_json: &str, new_image: Option<&str>, old_image: Option<&str>, sequence_number: &str, shard_id: &str, created_at: i64, user_identity: Option<&str>, ) -> Result<()>

Insert a stream record with optional user identity (for TTL deletions).

Source

pub fn next_stream_sequence_number(&self, table_name: &str) -> Result<i64>

Get the next sequence number for a table’s stream.

Source

pub fn get_stream_records( &self, table_name: &str, shard_id: &str, after_sequence: i64, limit: usize, ) -> Result<Vec<StreamRecord>>

Get stream records for a shard starting after a given sequence number.

Source

pub fn list_stream_enabled_tables(&self) -> Result<Vec<TableMetadata>>

List tables that have streams enabled.

Source

pub fn update_ttl_config( &self, table_name: &str, attribute_name: Option<&str>, enabled: bool, ) -> Result<()>

Update TTL configuration for a table.

Source

pub fn list_ttl_enabled_tables(&self) -> Result<Vec<TableMetadata>>

List tables that have TTL enabled.

Source

pub fn get_shard_sequence_range( &self, table_name: &str, shard_id: &str, ) -> Result<(Option<String>, Option<String>)>

Get the min and max sequence numbers for a shard.

Source

pub fn touch_cached_at( &self, table_name: &str, pk: &str, sk: &str, timestamp: f64, ) -> Result<()>

Update the cached_at timestamp for a single item.

Source

pub fn get_lru_items( &self, table_name: &str, limit: usize, ) -> Result<Vec<(String, String, i64)>>

Get items ordered by cached_at (oldest first) for LRU eviction.

Returns (pk, sk, item_size) tuples. Items with NULL cached_at are excluded (they were never cached from a remote source).

Trait Implementations§

Source§

impl StorageBackend for Storage

Source§

fn clock(&self) -> &dyn Clock

Wall-clock access for the stream and TTL paths. Read more
Source§

async fn insert_table_metadata( &self, m: &CreateTableMetadata<'_>, ) -> Result<(), BackendError>

Source§

async fn get_table_metadata( &self, table_name: &str, ) -> Result<Option<TableMetadata>, BackendError>

Source§

async fn delete_table_metadata( &self, table_name: &str, ) -> Result<bool, BackendError>

Source§

async fn update_table_metadata( &self, table_name: &str, attribute_definitions: &str, gsi_definitions: Option<&str>, ) -> Result<(), BackendError>

Source§

async fn update_vector_index_definitions( &self, table_name: &str, vector_index_definitions: Option<&str>, ) -> Result<(), BackendError>

Update a table’s vector index definitions. The write the add/delete-vector path of UpdateTable issues; None clears the column when no vector indexes remain.
Source§

async fn update_provisioned_throughput( &self, table_name: &str, provisioned_throughput: &str, ) -> Result<(), BackendError>

Source§

async fn clear_provisioned_throughput( &self, table_name: &str, ) -> Result<(), BackendError>

Source§

async fn update_billing_mode( &self, table_name: &str, billing_mode: &str, ) -> Result<(), BackendError>

Source§

async fn update_table_class( &self, table_name: &str, table_class: &str, ) -> Result<(), BackendError>

Source§

async fn update_on_demand_throughput( &self, table_name: &str, on_demand_throughput: &str, ) -> Result<(), BackendError>

Store the serialised on-demand throughput ceilings. Implementations must store the payload opaquely: the clear_on_demand_throughput default passes a JSON null through this method, which every reader treats as absent, so parsing or rejecting the payload here would break that default.
Source§

async fn clear_on_demand_throughput( &self, table_name: &str, ) -> Result<(), BackendError>

Remove any stored on-demand throughput ceilings. The default stores a JSON null, which every reader treats as absent, so existing backend implementations keep working without changes; the in-tree backends override this to clear the underlying value properly.
Source§

async fn get_tags(&self, table_name: &str) -> Result<Vec<Tag>, BackendError>

Source§

async fn set_tags( &self, table_name: &str, new_tags: &[Tag], ) -> Result<(), BackendError>

Source§

async fn update_deletion_protection( &self, table_name: &str, enabled: bool, ) -> Result<(), BackendError>

Source§

async fn remove_tags( &self, table_name: &str, keys: &[String], ) -> Result<(), BackendError>

Source§

async fn list_table_names(&self) -> Result<Vec<String>, BackendError>

Source§

async fn table_exists(&self, table_name: &str) -> Result<bool, BackendError>

Source§

async fn create_data_table(&self, table_name: &str) -> Result<(), BackendError>

Source§

async fn drop_data_table(&self, table_name: &str) -> Result<(), BackendError>

Source§

async fn create_gsi_table( &self, table_name: &str, index_name: &str, ) -> Result<(), BackendError>

Source§

async fn drop_gsi_table( &self, table_name: &str, index_name: &str, ) -> Result<(), BackendError>

Source§

async fn create_lsi_table( &self, table_name: &str, index_name: &str, ) -> Result<(), BackendError>

Source§

async fn drop_lsi_table( &self, table_name: &str, index_name: &str, ) -> Result<(), BackendError>

Source§

async fn create_vector_table( &self, table_name: &str, index_name: &str, ) -> Result<(), BackendError>

Create the physical shadow table for a vector index.
Source§

async fn drop_vector_table( &self, table_name: &str, index_name: &str, ) -> Result<(), BackendError>

Drop the physical shadow table for a vector index, if it exists.
Source§

async fn insert_vector_items( &self, table_name: &str, index_name: &str, rows: &[VectorItemRow], ) -> Result<(), BackendError>

Bulk-insert many rows into one vector shadow table. Read more
Source§

async fn delete_vector_item( &self, table_name: &str, index_name: &str, table_pk: &str, table_sk: &str, ) -> Result<(), BackendError>

Delete a vector shadow-table row by base-table primary key. Used by the live-write maintenance fan-out, mirroring delete_gsi_item.
Source§

async fn query_vector_candidates( &self, table_name: &str, index_name: &str, hash_value: Option<&str>, ) -> Result<Vec<VectorCandidateRow>, BackendError>

Load the rows SearchVectors scores, optionally scoped to one SearchSchema HASH value (key-string encoded, matching the write path’s hash_value column). Rows come back ordered by base-table primary key so equal scores tie-break deterministically.
Source§

async fn vector_items_for_keys( &self, table_name: &str, index_name: &str, keys: &[(String, String)], ) -> Result<Vec<(String, String, String)>, BackendError>

Load the projected entries for the base-table keys a search returns. Read more
Source§

async fn insert_gsi_item( &self, table_name: &str, index_name: &str, gsi_pk: &str, gsi_sk: &str, table_pk: &str, table_sk: &str, item_json: &str, ) -> Result<(), BackendError>

Source§

async fn insert_gsi_items( &self, table_name: &str, index_name: &str, rows: &[GsiItemRow], ) -> Result<(), BackendError>

Bulk-insert many rows into one GSI table. Read more
Source§

async fn delete_gsi_item( &self, table_name: &str, index_name: &str, table_pk: &str, table_sk: &str, ) -> Result<(), BackendError>

Source§

async fn query_gsi_items( &self, table_name: &str, index_name: &str, gsi_pk: &str, params: &QueryParams<'_>, ) -> Result<Vec<(String, String, String)>, BackendError>

Source§

async fn scan_gsi_items( &self, table_name: &str, index_name: &str, params: &ScanParams<'_>, ) -> Result<Vec<(String, String, String)>, BackendError>

Source§

async fn insert_lsi_item( &self, table_name: &str, index_name: &str, pk: &str, sk: &str, base_pk: &str, base_sk: &str, item_json: &str, ) -> Result<(), BackendError>

Source§

async fn delete_lsi_item( &self, table_name: &str, index_name: &str, base_pk: &str, base_sk: &str, ) -> Result<(), BackendError>

Source§

async fn query_lsi_items( &self, table_name: &str, index_name: &str, pk: &str, params: &QueryParams<'_>, ) -> Result<Vec<(String, String, String)>, BackendError>

Source§

async fn scan_lsi_items( &self, table_name: &str, index_name: &str, params: &ScanParams<'_>, ) -> Result<Vec<(String, String, String)>, BackendError>

Source§

async fn begin_transaction(&self) -> Result<(), BackendError>

Source§

async fn commit(&self) -> Result<(), BackendError>

Source§

async fn rollback(&self) -> Result<(), BackendError>

Source§

async fn recorded_schema_version(&self) -> Result<Option<u32>, BackendError>

The schema version the database records, or None when it records none, or one that isn’t a number.
Source§

async fn record_schema_version(&self, version: u32) -> Result<(), BackendError>

Record version as the database’s schema version, replacing any recorded one.
Source§

async fn enable_bulk_loading(&self) -> Result<(), BackendError>

Source§

async fn disable_bulk_loading(&self) -> Result<(), BackendError>

Source§

async fn put_item( &self, table_name: &str, pk: &str, sk: &str, item_json: &str, item_size: usize, ) -> Result<Option<String>, BackendError>

Source§

async fn put_item_with_hash( &self, table_name: &str, pk: &str, sk: &str, item_json: &str, item_size: usize, hash_prefix: &str, ) -> Result<Option<String>, BackendError>

Source§

async fn put_base_items( &self, table_name: &str, rows: &[BaseItemRow], ) -> Result<(), BackendError>

Bulk-insert many base-table rows in one call (INSERT OR REPLACE). Read more
Source§

async fn get_item( &self, table_name: &str, pk: &str, sk: &str, ) -> Result<Option<String>, BackendError>

Source§

async fn get_partition_size( &self, table_name: &str, pk: &str, ) -> Result<i64, BackendError>

Source§

async fn get_lsi_partition_size( &self, table_name: &str, index_name: &str, pk: &str, ) -> Result<i64, BackendError>

Source§

async fn delete_item( &self, table_name: &str, pk: &str, sk: &str, ) -> Result<Option<String>, BackendError>

Source§

async fn query_items( &self, table_name: &str, pk: &str, params: &QueryParams<'_>, ) -> Result<Vec<(String, String, String)>, BackendError>

Source§

async fn scan_items( &self, table_name: &str, params: &ScanParams<'_>, ) -> Result<Vec<(String, String, String)>, BackendError>

Source§

async fn count_items(&self, table_name: &str) -> Result<i64, BackendError>

Source§

async fn item_count_and_size( &self, table_name: &str, ) -> Result<(i64, i64), BackendError>

The number of items in a data table and the sum of their stored item_size, which is the DynamoDB item size each write computed.
Source§

async fn gsi_item_count_and_size( &self, table_name: &str, index_name: &str, whole_items: bool, ) -> Result<(i64, i64), BackendError>

The number of entries in a GSI and the total of their projected item sizes: its ItemCount and IndexSizeBytes. whole_items is true for an ALL projection, where each entry is the base item and the base table’s stored size is its size; any other projection sizes each entry’s stored JSON.
Source§

async fn lsi_item_count_and_size( &self, table_name: &str, index_name: &str, whole_items: bool, ) -> Result<(i64, i64), BackendError>

Source§

async fn vector_item_count_and_size( &self, table_name: &str, index_name: &str, ) -> Result<(i64, i64), BackendError>

The number of entries in a vector index and the total of their stored billable sizes: its ItemCount and IndexSizeBytes.
Source§

async fn set_item_sizes( &self, table_name: &str, sizes: &[(String, String, usize)], ) -> Result<(), BackendError>

Rewrite the stored item_size of the given rows, each a (pk, sk, item_size), leaving the rows otherwise unchanged.
Source§

async fn db_size_bytes(&self) -> Result<u64, BackendError>

Source§

async fn table_count(&self) -> Result<usize, BackendError>

Source§

async fn table_stats(&self) -> Result<Vec<TableStats>, BackendError>

Source§

async fn database_info(&self) -> Result<DatabaseInfo, BackendError>

Source§

async fn vacuum(&self) -> Result<(), BackendError>

Source§

async fn enable_stream( &self, table_name: &str, view_type: &str, label: &str, ) -> Result<(), BackendError>

Source§

async fn disable_stream(&self, table_name: &str) -> Result<(), BackendError>

Source§

async fn insert_stream_record( &self, table_name: &str, event_name: &str, keys_json: &str, new_image: Option<&str>, old_image: Option<&str>, sequence_number: &str, shard_id: &str, created_at: i64, ) -> Result<(), BackendError>

Source§

async fn insert_stream_record_with_identity( &self, table_name: &str, event_name: &str, keys_json: &str, new_image: Option<&str>, old_image: Option<&str>, sequence_number: &str, shard_id: &str, created_at: i64, user_identity: Option<&str>, ) -> Result<(), BackendError>

Source§

async fn next_stream_sequence_number( &self, table_name: &str, ) -> Result<i64, BackendError>

Source§

async fn get_stream_records( &self, table_name: &str, shard_id: &str, after_sequence: i64, limit: usize, ) -> Result<Vec<StreamRecord>, BackendError>

Source§

async fn list_stream_enabled_tables( &self, ) -> Result<Vec<TableMetadata>, BackendError>

Source§

async fn update_ttl_config( &self, table_name: &str, attribute_name: Option<&str>, enabled: bool, ) -> Result<(), BackendError>

Source§

async fn list_ttl_enabled_tables( &self, ) -> Result<Vec<TableMetadata>, BackendError>

Source§

async fn get_shard_sequence_range( &self, table_name: &str, shard_id: &str, ) -> Result<(Option<String>, Option<String>), BackendError>

Source§

async fn touch_cached_at( &self, table_name: &str, pk: &str, sk: &str, timestamp: f64, ) -> Result<(), BackendError>

Source§

async fn get_lru_items( &self, table_name: &str, limit: usize, ) -> Result<Vec<(String, String, i64)>, BackendError>

Source§

fn supports_streams(&self) -> bool

Whether this backend can record and serve DynamoDB Streams. Read more
Source§

fn supports_tags(&self) -> bool

Whether this backend stores resource tags. Same contract as supports_streams: consulted before a mutation that would need set_tags, so a tagged CreateTable on a backend without tags is refused whole rather than creating the table and then failing.
Source§

async fn apply_index_writes( &self, ops: &[IndexWriteOp], ) -> Result<(), BackendError>

Apply an ordered batch of GSI/LSI write operations. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Fake for T

Source§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: Rng + ?Sized, Self: FakeBase<U>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more