large rewrite to make mize run on every platform

This commit is contained in:
Sebastian Moser
2024-05-18 08:31:38 +02:00
parent 75a6dca3fc
commit a16c2f9221
37 changed files with 624 additions and 970 deletions

View File

@@ -0,0 +1,27 @@
use crate::error::MizeResult;
use crate::item::{Item, ItemData};
use crate::id::MizeId;
pub trait Store {
// should have the ability to be multi threaded, if the underlying implementation supports
// multithreaded IO operations
// for now all refs to a store hold a Mutex but this mutex is part of where the MizeStore trait
// is implemented, so that there can be a multithreaded implementation
//fn get(self, id: MizeId) -> MizeResult<Item<Self>> where Self: Sized;
fn set<T: Into<ItemData>>(self, id: MizeId, data: T) -> MizeResult<()>;
// in the future should implement transactions, ....
// funcs to do with links, backlinks
fn get_links(self, item: Item<Self>) -> MizeResult<Vec<MizeId>> where Self: Sized;
fn get_backlinks(self, item: Item<Self>) -> MizeResult<Vec<MizeId>> where Self: Sized;
fn new_id(&self) -> MizeResult<MizeId>;
}
/// references an item that is stored in a store
pub trait StoreRef {
// do we need this or is this basically an item
}