Files
mize/src/core/instance/store.rs
2024-05-31 12:05:53 +02:00

26 lines
965 B
Rust

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>>(&mut 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<String>;
fn get_value_raw(&self, id: MizeId) -> MizeResult<Vec<u8>>;
}