bee-storage 0.1.0-alpha

A general purpose storage backend crate with key value abstraction API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
// Copyright 2020 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use crate::backend::StorageBackend;

/// `Fetch<K, V>` trait extends the `StorageBackend` with `fetch` operation for the (key: K, value: V pair);
/// therefore, it should be explicitly implemented for the corresponding `StorageBackend`.
#[async_trait::async_trait]
pub trait Fetch<K, V>: StorageBackend {
    /// Fetches the value associated with the key from the storage.
    async fn fetch(&self, key: &K) -> Result<Option<V>, Self::Error>;
}