use std::{future::Future, io::Result, time::SystemTime};
use libipld::Cid;
use crate::mail::MailContent;
pub struct Entry {
pub cid: Cid,
pub length: u64,
pub created: SystemTime,
}
pub trait IpldFS {
type ReadEntry<'cx>: Future<Output = Result<Entry>> + Send + Unpin + 'cx
where
Self: 'cx;
type Write<'cx>: Future<Output = Result<Vec<Cid>>> + Send + Unpin + 'cx
where
Self: 'cx;
type Read<'cx>: Future<Output = Result<MailContent>> + Send + Unpin + 'cx
where
Self: 'cx;
type Delete<'cx>: Future<Output = Result<()>> + Send + Unpin + 'cx
where
Self: 'cx;
fn read_entry<'cx, 'a>(&'a mut self, cid: Cid) -> Self::ReadEntry<'cx>
where
'a: 'cx;
fn write<'cx, 'a>(&'a mut self, cid: Cid, content: MailContent) -> Self::Write<'cx>
where
'a: 'cx;
fn read<'cx, 'a>(&'a mut self, cid: &'cx Cid) -> Self::Read<'cx>
where
'a: 'cx;
fn delete<'cx, 'a>(&'a mut self, cid: &'cx Cid) -> Self::Delete<'cx>
where
'a: 'cx;
}