Skip to main content

RemoteStoreBackend

Trait RemoteStoreBackend 

Source
pub trait RemoteStoreBackend: Send + Sync {
    type Error: Error + Send + Sync + 'static;

Show 22 methods // Required methods async fn get_node(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Self::Error>; async fn put_node( &self, key: &[u8], value: &[u8], ) -> Result<(), Self::Error>; async fn delete_node(&self, key: &[u8]) -> Result<(), Self::Error>; async fn list_node_cids(&self) -> Result<Vec<Vec<u8>>, Self::Error>; async fn get_root_manifest( &self, name: &[u8], ) -> Result<Option<Vec<u8>>, Self::Error>; async fn put_root_manifest( &self, name: &[u8], manifest: &[u8], ) -> Result<(), Self::Error>; async fn delete_root_manifest(&self, name: &[u8]) -> Result<(), Self::Error>; async fn compare_and_swap_root_manifest( &self, name: &[u8], expected: Option<&[u8]>, new: Option<&[u8]>, ) -> Result<RemoteManifestUpdate, Self::Error>; async fn list_root_manifests( &self, ) -> Result<Vec<RemoteNamedRoot>, Self::Error>; // Provided methods async fn batch_nodes( &self, ops: &[RemoteBatchOp<'_>], ) -> Result<(), Self::Error> { ... } async fn batch_get_nodes_ordered( &self, keys: &[&[u8]], ) -> Result<Vec<Option<Vec<u8>>>, Self::Error> { ... } async fn batch_put_nodes( &self, entries: &[(&[u8], &[u8])], ) -> Result<(), Self::Error> { ... } fn prefers_batch_reads(&self) -> bool { ... } fn read_parallelism(&self) -> usize { ... } fn supports_hints(&self) -> bool { ... } fn prefers_rightmost_path_hints(&self) -> bool { ... } async fn get_hint( &self, namespace: &[u8], key: &[u8], ) -> Result<Option<Vec<u8>>, Self::Error> { ... } async fn put_hint( &self, namespace: &[u8], key: &[u8], value: &[u8], ) -> Result<(), Self::Error> { ... } async fn batch_put_nodes_with_hint( &self, entries: &[(&[u8], &[u8])], namespace: &[u8], key: &[u8], value: &[u8], ) -> Result<(), Self::Error> { ... } async fn publish_nodes( &self, publication: NodePublication<'_>, ) -> Result<(), Self::Error> { ... } fn supports_transactions(&self) -> bool { ... } async fn commit_transaction( &self, _node_writes: &[RemoteBatchOp<'_>], _root_conditions: &[RemoteRootCondition], _root_writes: &[RemoteRootWrite], ) -> Result<RemoteTransactionUpdate, Self::Error> { ... }
}
Expand description

Backend capability contract used by all provider adapters.

Implementations should map these operations to native provider primitives:

  • SQL stores should use transactions for batch_nodes and root CAS.
  • DynamoDB should use conditional writes for root CAS.
  • Cosmos DB should use partitioned documents and ETag or conditional writes.
  • Spanner should use read/write transactions for root CAS.
  • Redis should use Lua or WATCH/MULTI for root CAS and requires durable persistence if used as a primary store.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Backend error type.

Required Methods§

Source

async fn get_node(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Self::Error>

Read one content-addressed node by CID bytes.

Source

async fn put_node(&self, key: &[u8], value: &[u8]) -> Result<(), Self::Error>

Store one content-addressed node by CID bytes.

Source

async fn delete_node(&self, key: &[u8]) -> Result<(), Self::Error>

Delete one content-addressed node by CID bytes.

Source

async fn list_node_cids(&self) -> Result<Vec<Vec<u8>>, Self::Error>

List all content-addressed node CIDs.

Implementations must return only node CIDs, not hints, root manifests, or provider metadata. Results should be sorted by raw CID bytes for deterministic retention and GC planning.

Source

async fn get_root_manifest( &self, name: &[u8], ) -> Result<Option<Vec<u8>>, Self::Error>

Read a serialized root manifest.

Source

async fn put_root_manifest( &self, name: &[u8], manifest: &[u8], ) -> Result<(), Self::Error>

Write a serialized root manifest unconditionally.

Source

async fn delete_root_manifest(&self, name: &[u8]) -> Result<(), Self::Error>

Delete a root manifest.

Source

async fn compare_and_swap_root_manifest( &self, name: &[u8], expected: Option<&[u8]>, new: Option<&[u8]>, ) -> Result<RemoteManifestUpdate, Self::Error>

Compare-and-swap a serialized root manifest.

Source

async fn list_root_manifests(&self) -> Result<Vec<RemoteNamedRoot>, Self::Error>

List serialized root manifests sorted by raw name bytes.

Provided Methods§

Source

async fn batch_nodes( &self, ops: &[RemoteBatchOp<'_>], ) -> Result<(), Self::Error>

Apply node writes/deletes. Implementations should make this atomic when the provider supports it.

Source

async fn batch_get_nodes_ordered( &self, keys: &[&[u8]], ) -> Result<Vec<Option<Vec<u8>>>, Self::Error>

Read unique node keys in request order.

Source

async fn batch_put_nodes( &self, entries: &[(&[u8], &[u8])], ) -> Result<(), Self::Error>

Store multiple content-addressed nodes.

Source

fn prefers_batch_reads(&self) -> bool

Whether this backend has native or efficiently coalesced batch reads.

Source

fn read_parallelism(&self) -> usize

Maximum in-flight reads for default async traversal paths.

Source

fn supports_hints(&self) -> bool

Whether this backend persists optional performance hints.

Source

fn prefers_rightmost_path_hints(&self) -> bool

Whether append-heavy writes should maintain rightmost-path hints.

Source

async fn get_hint( &self, namespace: &[u8], key: &[u8], ) -> Result<Option<Vec<u8>>, Self::Error>

Read an optional performance hint.

Source

async fn put_hint( &self, namespace: &[u8], key: &[u8], value: &[u8], ) -> Result<(), Self::Error>

Write an optional performance hint.

Source

async fn batch_put_nodes_with_hint( &self, entries: &[(&[u8], &[u8])], namespace: &[u8], key: &[u8], value: &[u8], ) -> Result<(), Self::Error>

Store content-addressed nodes and one hint atomically when supported.

Source

async fn publish_nodes( &self, publication: NodePublication<'_>, ) -> Result<(), Self::Error>

Publish canonical immutable nodes with advisory logical context.

Source

fn supports_transactions(&self) -> bool

Whether this backend can atomically validate root conditions and commit staged node/root writes.

Source

async fn commit_transaction( &self, _node_writes: &[RemoteBatchOp<'_>], _root_conditions: &[RemoteRootCondition], _root_writes: &[RemoteRootWrite], ) -> Result<RemoteTransactionUpdate, Self::Error>

Atomically validate serialized root conditions, write nodes, and apply serialized root writes. Implementations should return RemoteTransactionUpdate::Conflict without applying any writes when a condition fails.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T> RemoteStoreBackend for Arc<T>

Source§

type Error = <T as RemoteStoreBackend>::Error

Source§

async fn get_node( &self, key: &[u8], ) -> Result<Option<Vec<u8>>, <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn put_node( &self, key: &[u8], value: &[u8], ) -> Result<(), <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn delete_node( &self, key: &[u8], ) -> Result<(), <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn batch_nodes( &self, ops: &[RemoteBatchOp<'_>], ) -> Result<(), <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn batch_get_nodes_ordered( &self, keys: &[&[u8]], ) -> Result<Vec<Option<Vec<u8>>>, <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn batch_put_nodes( &self, entries: &[(&[u8], &[u8])], ) -> Result<(), <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn list_node_cids( &self, ) -> Result<Vec<Vec<u8>>, <Arc<T> as RemoteStoreBackend>::Error>

Source§

fn prefers_batch_reads(&self) -> bool

Source§

fn read_parallelism(&self) -> usize

Source§

fn supports_hints(&self) -> bool

Source§

fn prefers_rightmost_path_hints(&self) -> bool

Source§

async fn get_hint( &self, namespace: &[u8], key: &[u8], ) -> Result<Option<Vec<u8>>, <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn put_hint( &self, namespace: &[u8], key: &[u8], value: &[u8], ) -> Result<(), <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn batch_put_nodes_with_hint( &self, entries: &[(&[u8], &[u8])], namespace: &[u8], key: &[u8], value: &[u8], ) -> Result<(), <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn publish_nodes( &self, publication: NodePublication<'_>, ) -> Result<(), <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn get_root_manifest( &self, name: &[u8], ) -> Result<Option<Vec<u8>>, <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn put_root_manifest( &self, name: &[u8], manifest: &[u8], ) -> Result<(), <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn delete_root_manifest( &self, name: &[u8], ) -> Result<(), <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn compare_and_swap_root_manifest( &self, name: &[u8], expected: Option<&[u8]>, new: Option<&[u8]>, ) -> Result<RemoteManifestUpdate, <Arc<T> as RemoteStoreBackend>::Error>

Source§

async fn list_root_manifests( &self, ) -> Result<Vec<RemoteNamedRoot>, <Arc<T> as RemoteStoreBackend>::Error>

Source§

fn supports_transactions(&self) -> bool

Source§

async fn commit_transaction( &self, node_writes: &[RemoteBatchOp<'_>], root_conditions: &[RemoteRootCondition], root_writes: &[RemoteRootWrite], ) -> Result<RemoteTransactionUpdate, <Arc<T> as RemoteStoreBackend>::Error>

Implementors§