bee_storage/access/
fetch.rs

1// Copyright 2020-2021 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4use crate::backend::StorageBackend;
5
6/// `Fetch<K, V>` trait extends the `StorageBackend` with `fetch` operation for the (key: K, value: V pair);
7/// therefore, it should be explicitly implemented for the corresponding `StorageBackend`.
8pub trait Fetch<K, V>: StorageBackend {
9    /// Fetches the value associated with the key from the storage.
10    fn fetch(&self, key: &K) -> Result<Option<V>, Self::Error>;
11}