Skip to main content

DhtStorage

Trait DhtStorage 

Source
pub trait DhtStorage: Send + Sync {
    // Required methods
    fn store(&self, key: &[u8], data: &[u8]) -> Result<()>;
    fn retrieve(&self, key: &[u8]) -> Result<Option<Vec<u8>>>;
    fn delete(&self, key: &[u8]) -> Result<()>;
    fn exists(&self, key: &[u8]) -> Result<bool>;
}
Expand description

Distributed hash table storage backend.

Default implementation is in-memory (for testing/standalone usage). Enable dht-storage feature for real lib-storage integration.

Required Methods§

Source

fn store(&self, key: &[u8], data: &[u8]) -> Result<()>

Store a value in the DHT.

Source

fn retrieve(&self, key: &[u8]) -> Result<Option<Vec<u8>>>

Retrieve a value from the DHT.

Source

fn delete(&self, key: &[u8]) -> Result<()>

Delete a value from the DHT.

Source

fn exists(&self, key: &[u8]) -> Result<bool>

Check if a key exists in the DHT.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§