pub trait RemoteStoreBackend: Send + Sync {
type Error: StdError + 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_nodesand 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/MULTIfor root CAS and requires durable persistence if used as a primary store.
Required Associated Types§
Required Methods§
Sourceasync fn get_node(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Self::Error>
async fn get_node(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Self::Error>
Read one content-addressed node by CID bytes.
Sourceasync fn put_node(&self, key: &[u8], value: &[u8]) -> Result<(), Self::Error>
async fn put_node(&self, key: &[u8], value: &[u8]) -> Result<(), Self::Error>
Store one content-addressed node by CID bytes.
Sourceasync fn delete_node(&self, key: &[u8]) -> Result<(), Self::Error>
async fn delete_node(&self, key: &[u8]) -> Result<(), Self::Error>
Delete one content-addressed node by CID bytes.
Sourceasync fn list_node_cids(&self) -> Result<Vec<Vec<u8>>, Self::Error>
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.
Sourceasync fn get_root_manifest(
&self,
name: &[u8],
) -> Result<Option<Vec<u8>>, Self::Error>
async fn get_root_manifest( &self, name: &[u8], ) -> Result<Option<Vec<u8>>, Self::Error>
Read a serialized root manifest.
Sourceasync fn put_root_manifest(
&self,
name: &[u8],
manifest: &[u8],
) -> Result<(), Self::Error>
async fn put_root_manifest( &self, name: &[u8], manifest: &[u8], ) -> Result<(), Self::Error>
Write a serialized root manifest unconditionally.
Sourceasync fn delete_root_manifest(&self, name: &[u8]) -> Result<(), Self::Error>
async fn delete_root_manifest(&self, name: &[u8]) -> Result<(), Self::Error>
Delete a root manifest.
Sourceasync fn compare_and_swap_root_manifest(
&self,
name: &[u8],
expected: Option<&[u8]>,
new: Option<&[u8]>,
) -> Result<RemoteManifestUpdate, Self::Error>
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.
Sourceasync fn list_root_manifests(&self) -> Result<Vec<RemoteNamedRoot>, Self::Error>
async fn list_root_manifests(&self) -> Result<Vec<RemoteNamedRoot>, Self::Error>
List serialized root manifests sorted by raw name bytes.
Provided Methods§
Sourceasync fn batch_nodes(
&self,
ops: &[RemoteBatchOp<'_>],
) -> Result<(), Self::Error>
async fn batch_nodes( &self, ops: &[RemoteBatchOp<'_>], ) -> Result<(), Self::Error>
Apply node writes/deletes. Implementations should make this atomic when the provider supports it.
Sourceasync fn batch_get_nodes_ordered(
&self,
keys: &[&[u8]],
) -> Result<Vec<Option<Vec<u8>>>, Self::Error>
async fn batch_get_nodes_ordered( &self, keys: &[&[u8]], ) -> Result<Vec<Option<Vec<u8>>>, Self::Error>
Read unique node keys in request order.
Sourceasync fn batch_put_nodes(
&self,
entries: &[(&[u8], &[u8])],
) -> Result<(), Self::Error>
async fn batch_put_nodes( &self, entries: &[(&[u8], &[u8])], ) -> Result<(), Self::Error>
Store multiple content-addressed nodes.
Sourcefn prefers_batch_reads(&self) -> bool
fn prefers_batch_reads(&self) -> bool
Whether this backend has native or efficiently coalesced batch reads.
Sourcefn read_parallelism(&self) -> usize
fn read_parallelism(&self) -> usize
Maximum in-flight reads for default async traversal paths.
Sourcefn supports_hints(&self) -> bool
fn supports_hints(&self) -> bool
Whether this backend persists optional performance hints.
Sourcefn prefers_rightmost_path_hints(&self) -> bool
fn prefers_rightmost_path_hints(&self) -> bool
Whether append-heavy writes should maintain rightmost-path hints.
Sourceasync fn get_hint(
&self,
namespace: &[u8],
key: &[u8],
) -> Result<Option<Vec<u8>>, Self::Error>
async fn get_hint( &self, namespace: &[u8], key: &[u8], ) -> Result<Option<Vec<u8>>, Self::Error>
Read an optional performance hint.
Sourceasync fn put_hint(
&self,
namespace: &[u8],
key: &[u8],
value: &[u8],
) -> Result<(), Self::Error>
async fn put_hint( &self, namespace: &[u8], key: &[u8], value: &[u8], ) -> Result<(), Self::Error>
Write an optional performance hint.
Sourceasync fn batch_put_nodes_with_hint(
&self,
entries: &[(&[u8], &[u8])],
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>
Store content-addressed nodes and one hint atomically when supported.
Sourceasync fn publish_nodes(
&self,
publication: NodePublication<'_>,
) -> Result<(), Self::Error>
async fn publish_nodes( &self, publication: NodePublication<'_>, ) -> Result<(), Self::Error>
Publish canonical immutable nodes with advisory logical context.
Sourcefn supports_transactions(&self) -> bool
fn supports_transactions(&self) -> bool
Whether this backend can atomically validate root conditions and commit staged node/root writes.
Sourceasync fn commit_transaction(
&self,
_node_writes: &[RemoteBatchOp<'_>],
_root_conditions: &[RemoteRootCondition],
_root_writes: &[RemoteRootWrite],
) -> Result<RemoteTransactionUpdate, Self::Error>
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".