pub trait SeedStore {
// Required methods
fn put_node(&mut self, canonical: &[u8]) -> Result<NodeId>;
fn get_node(&self, id: &NodeId) -> Result<Vec<u8>>;
fn get_node_range(
&self,
id: &NodeId,
offset: u64,
len: u64,
) -> Result<Vec<u8>>;
fn contains_node(&self, id: &NodeId) -> Result<bool>;
fn list_nodes(&self) -> Result<Vec<(NodeId, u64)>>;
}Expand description
A content-addressed store of canonical procedural seed nodes.
put takes &mut self (ids are content-derived, so retries are idempotent).
Required Methods§
Sourcefn put_node(&mut self, canonical: &[u8]) -> Result<NodeId>
fn put_node(&mut self, canonical: &[u8]) -> Result<NodeId>
Store the canonical bytes of one node, returning its content id.
Idempotent and at-least-once: identical bytes always return the same id
and are stored once. A returned id guarantees the bytes are durable under
SeedStore::get_node.
Sourcefn get_node(&self, id: &NodeId) -> Result<Vec<u8>>
fn get_node(&self, id: &NodeId) -> Result<Vec<u8>>
Fetch the exact canonical bytes for id.
MUST verify NodeId::of_node(bytes) == id before returning.
Sourcefn get_node_range(&self, id: &NodeId, offset: u64, len: u64) -> Result<Vec<u8>>
fn get_node_range(&self, id: &NodeId, offset: u64, len: u64) -> Result<Vec<u8>>
Fetch len bytes of id starting at offset (strict; no EOF clip).
Sourcefn contains_node(&self, id: &NodeId) -> Result<bool>
fn contains_node(&self, id: &NodeId) -> Result<bool>
Whether id is present.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".