dwn_core/store/data.rs
1use xdid::core::did::Did;
2
3use crate::message::data::Data;
4
5use super::StoreError;
6
7/// Maps IPLD hashes to their contents.
8pub trait DataStore: Send + Sync {
9 fn read(&self, target: &Did, cid: &str) -> Result<Option<Data>, StoreError>;
10
11 /// Adds a reference to a CID.
12 fn add_ref(&self, target: &Did, cid: &str, data: Option<Data>) -> Result<(), StoreError>;
13
14 /// Removes a reference to a CID.
15 fn remove_ref(&self, target: &Did, cid: &str) -> Result<(), StoreError>;
16}