bee-storage 1.0.0

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

use crate::backend::StorageBackend;

/// `Update<K, V>` trait extends the `StorageBackend` with `update` operation for the (key: K, value: V) pair;
/// therefore, it should be explicitly implemented for the corresponding `StorageBackend`.
pub trait Update<K, V>: StorageBackend {
    /// Fetches the value for the key `K` and updates it using `f`.
    fn update(&self, key: &K, f: impl FnMut(&mut V)) -> Result<(), Self::Error>;
}