Crates.io | daglib |
lib.rs | daglib |
version | 0.1.0 |
source | src |
created_at | 2022-12-28 16:40:23.7097 |
updated_at | 2022-12-28 16:40:23.7097 |
description | Generic async DAG library |
homepage | |
repository | https://github.com/matthiasbeyer/daglib |
max_upload_size | |
id | 746906 |
size | 50,249 |
Async DAG library generic over Node type, Node Identifier Type and Backend (storage of the DAG).
Experimental. Do not use.
My Problem was, that I wanted to implement a DAG on IPFS/IPLD. The Problem, though, is that the existing IPFS/IPLD libraries do not feature functionality to build a DAG easily. There are libraries for DAGs, but they all implemented the storage functionality themselves. I needed a backend that is async and generic, so that I can use IPFS (or anything else that works async) in the backend. So this lib was born.
This library does define a simple interface for the underlying backend:
#[async_trait]
pub trait DagBackend<Id, N>
where N: Node,
Id: NodeId + Send
{
async fn get(&self, id: Id) -> Result<Option<N>>;
async fn put(&mut self, node: N) -> Result<Id>;
}
and that's it. The AsyncDag
type implements the DAG data structure on top of
that.
Because this library was initialized to be used with IPFS in the backend, is has some limitations:
This list will be extended in the future. Do not assume it is complete!
MPL-2.0