bee_storage/access/multi_fetch.rs
1// Copyright 2020-2021 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4use crate::backend::StorageBackend;
5
6/// `MultiFetch<'a, K, V>` trait extends the `StorageBackend` with `multi_fetch` operation for the (key: K, value: V)
7/// pair; therefore, it should be explicitly implemented for the corresponding `StorageBackend`.
8pub trait MultiFetch<'a, K, V>: StorageBackend {
9 /// The iterator associated type over values.
10 type Iter: 'a + Iterator<Item = Result<Option<V>, Self::Error>>;
11
12 /// Fetches the values associated with the keys from the storage.
13 fn multi_fetch(&'a self, keys: &'a [K]) -> Result<Self::Iter, Self::Error>;
14}