Skip to main content

StorageBackend

Trait StorageBackend 

Source
pub trait StorageBackend {
Show 64 methods // Required methods fn clock(&self) -> &dyn Clock; async fn insert_table_metadata( &self, m: &CreateTableMetadata<'_>, ) -> Result<(), BackendError>; async fn get_table_metadata( &self, table_name: &str, ) -> Result<Option<TableMetadata>, BackendError>; async fn delete_table_metadata( &self, table_name: &str, ) -> Result<bool, BackendError>; async fn update_table_metadata( &self, table_name: &str, attribute_definitions: &str, gsi_definitions: Option<&str>, ) -> Result<(), BackendError>; async fn update_provisioned_throughput( &self, table_name: &str, provisioned_throughput: &str, ) -> Result<(), BackendError>; async fn clear_provisioned_throughput( &self, table_name: &str, ) -> Result<(), BackendError>; async fn update_billing_mode( &self, table_name: &str, billing_mode: &str, ) -> Result<(), BackendError>; async fn update_table_class( &self, table_name: &str, table_class: &str, ) -> Result<(), BackendError>; async fn update_on_demand_throughput( &self, table_name: &str, on_demand_throughput: &str, ) -> Result<(), BackendError>; async fn get_tags(&self, table_name: &str) -> Result<Vec<Tag>, BackendError>; async fn set_tags( &self, table_name: &str, new_tags: &[Tag], ) -> Result<(), BackendError>; async fn update_deletion_protection( &self, table_name: &str, enabled: bool, ) -> Result<(), BackendError>; async fn remove_tags( &self, table_name: &str, keys: &[String], ) -> Result<(), BackendError>; async fn list_table_names(&self) -> Result<Vec<String>, BackendError>; async fn table_exists(&self, table_name: &str) -> Result<bool, BackendError>; async fn create_data_table( &self, table_name: &str, ) -> Result<(), BackendError>; async fn drop_data_table( &self, table_name: &str, ) -> Result<(), BackendError>; async fn create_gsi_table( &self, table_name: &str, index_name: &str, ) -> Result<(), BackendError>; async fn drop_gsi_table( &self, table_name: &str, index_name: &str, ) -> Result<(), BackendError>; async fn create_lsi_table( &self, table_name: &str, index_name: &str, ) -> Result<(), BackendError>; async fn drop_lsi_table( &self, table_name: &str, index_name: &str, ) -> Result<(), BackendError>; 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>; async fn insert_gsi_items( &self, table_name: &str, index_name: &str, rows: &[GsiItemRow], ) -> Result<(), BackendError>; async fn delete_gsi_item( &self, table_name: &str, index_name: &str, table_pk: &str, table_sk: &str, ) -> Result<(), BackendError>; async fn query_gsi_items( &self, table_name: &str, index_name: &str, gsi_pk: &str, params: &QueryParams<'_>, ) -> Result<Vec<(String, String, String)>, BackendError>; async fn scan_gsi_items( &self, table_name: &str, index_name: &str, params: &ScanParams<'_>, ) -> Result<Vec<(String, String, String)>, BackendError>; 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>; async fn delete_lsi_item( &self, table_name: &str, index_name: &str, base_pk: &str, base_sk: &str, ) -> Result<(), BackendError>; async fn query_lsi_items( &self, table_name: &str, index_name: &str, pk: &str, params: &QueryParams<'_>, ) -> Result<Vec<(String, String, String)>, BackendError>; async fn scan_lsi_items( &self, table_name: &str, index_name: &str, params: &ScanParams<'_>, ) -> Result<Vec<(String, String, String)>, BackendError>; async fn begin_transaction(&self) -> Result<(), BackendError>; async fn commit(&self) -> Result<(), BackendError>; async fn rollback(&self) -> Result<(), BackendError>; async fn enable_bulk_loading(&self) -> Result<(), BackendError>; async fn disable_bulk_loading(&self) -> Result<(), BackendError>; async fn put_item( &self, table_name: &str, pk: &str, sk: &str, item_json: &str, item_size: usize, ) -> Result<Option<String>, BackendError>; 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>; async fn put_base_items( &self, table_name: &str, rows: &[BaseItemRow], ) -> Result<(), BackendError>; async fn get_item( &self, table_name: &str, pk: &str, sk: &str, ) -> Result<Option<String>, BackendError>; async fn get_partition_size( &self, table_name: &str, pk: &str, ) -> Result<i64, BackendError>; async fn get_lsi_partition_size( &self, table_name: &str, index_name: &str, pk: &str, ) -> Result<i64, BackendError>; async fn delete_item( &self, table_name: &str, pk: &str, sk: &str, ) -> Result<Option<String>, BackendError>; async fn query_items( &self, table_name: &str, pk: &str, params: &QueryParams<'_>, ) -> Result<Vec<(String, String, String)>, BackendError>; async fn scan_items( &self, table_name: &str, params: &ScanParams<'_>, ) -> Result<Vec<(String, String, String)>, BackendError>; async fn count_items(&self, table_name: &str) -> Result<i64, BackendError>; async fn db_size_bytes(&self) -> Result<u64, BackendError>; async fn table_count(&self) -> Result<usize, BackendError>; async fn table_stats(&self) -> Result<Vec<TableStats>, BackendError>; async fn database_info(&self) -> Result<DatabaseInfo, BackendError>; async fn vacuum(&self) -> Result<(), BackendError>; async fn enable_stream( &self, table_name: &str, view_type: &str, label: &str, ) -> Result<(), BackendError>; async fn disable_stream(&self, table_name: &str) -> Result<(), BackendError>; 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>; 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>; async fn next_stream_sequence_number( &self, table_name: &str, ) -> Result<i64, BackendError>; async fn get_stream_records( &self, table_name: &str, shard_id: &str, after_sequence: i64, limit: usize, ) -> Result<Vec<StreamRecord>, BackendError>; async fn list_stream_enabled_tables( &self, ) -> Result<Vec<TableMetadata>, BackendError>; async fn update_ttl_config( &self, table_name: &str, attribute_name: Option<&str>, enabled: bool, ) -> Result<(), BackendError>; async fn list_ttl_enabled_tables( &self, ) -> Result<Vec<TableMetadata>, BackendError>; async fn get_shard_sequence_range( &self, table_name: &str, shard_id: &str, ) -> Result<(Option<String>, Option<String>), BackendError>; async fn touch_cached_at( &self, table_name: &str, pk: &str, sk: &str, timestamp: f64, ) -> Result<(), BackendError>; async fn get_lru_items( &self, table_name: &str, limit: usize, ) -> Result<Vec<(String, String, i64)>, BackendError>; // Provided method async fn apply_index_writes( &self, ops: &[IndexWriteOp], ) -> Result<(), BackendError> { ... }
}
Expand description

Backend-neutral storage interface.

Method signatures mirror Storage’s public surface 1:1, with three mechanical transformations:

  1. Result<T, DynoxideError> becomes Result<T, BackendError>.
  2. fn becomes async fn.
  3. Filesystem-typed and rusqlite-typed methods are excluded; they remain on the native Storage only.

The trait is not consumed dynamically today. The native Storage and the wasm WasmBridgeBackend each implement it monomorphically.

The #[allow(async_fn_in_trait)] reflects the monomorphic-only consumption model. The lint can be revisited if and when dyn StorageBackend becomes a real callsite.

Required Methods§

Source

fn clock(&self) -> &dyn Clock

Wall-clock access for the stream and TTL paths.

Sync because reading the clock is not I/O. The native backend returns its injected Clock; the wasm SQLite backend supplies its own.

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_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>

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 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.

Batch-shaped so a backend can amortise per-row round-trips (the native backend reuses a single cached prepared statement). Used by the GSI backfill path; the per-row insert_gsi_item covers single writes during normal fan-out.

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 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).

Batch-shaped so a backend can amortise per-row round-trips (the native backend reuses a single cached prepared statement). Used by the import path. Writes cached_at verbatim from each BaseItemRow; see the note there for how this differs from put_item_with_hash.

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 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>

Provided Methods§

Source

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

Apply an ordered batch of GSI/LSI write operations.

The GSI/LSI maintenance helpers build the list and call this once per fan-out instead of invoking the per-item methods one at a time. The default impl replays each op through the matching per-item method in order, so a backend that does not override it behaves exactly as the per-op loop did. The wasm backend overrides this to issue the whole list in a single bridge crossing.

Owns no transaction: the caller’s open transaction supplies atomicity, so a mid-batch failure is rolled back by that caller. An empty list does no work.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§