Struct wildland_catlib::CatLib
source · [−]pub struct CatLib { /* private fields */ }Implementations
sourceimpl CatLib
impl CatLib
pub fn new(path: PathBuf) -> Self
sourcepub fn create_forest(
&self,
owner: Identity,
signers: Signers,
data: Vec<u8>
) -> CatlibResult<Forest>
pub fn create_forest(
&self,
owner: Identity,
signers: Signers,
data: Vec<u8>
) -> CatlibResult<Forest>
Create new Forest obect.
owner and signers are cryptographical objects that are used by the Core module to
verify the cryptographical integrity of the manifests.
data is an arbitrary data object that can be used to synchronize Forest state between
devices.
Errors
Returns RustbreakError cast on CatlibResult upon failure to save to the database.
Example
let forest_owner = Identity([1; 32]);
let signer = Identity([2; 32]);
let catlib = CatLib::default();
let forest = catlib.create_forest(
forest_owner,
HashSet::from([signer]),
vec![],
).unwrap();sourcepub fn get_forest(&self, uuid: Uuid) -> CatlibResult<Forest>
pub fn get_forest(&self, uuid: Uuid) -> CatlibResult<Forest>
Return Forest object by Forest UUID.
sourcepub fn find_forest(&self, owner: Identity) -> CatlibResult<Forest>
pub fn find_forest(&self, owner: Identity) -> CatlibResult<Forest>
Return Forest owned by specified owner.
Note: by design each owner may have only one Forest
Errors
- Returns
CatlibError::NoRecordsFoundif noForestwas found. - Returns
CatlibError::MalformedDatabaseEntryif more than oneForestwas found.
sourcepub fn get_container(&self, uuid: Uuid) -> CatlibResult<Container>
pub fn get_container(&self, uuid: Uuid) -> CatlibResult<Container>
Return Container object by Container UUID.
sourcepub fn find_storages_with_template(
&self,
template_id: Uuid
) -> CatlibResult<Vec<Storage>>
pub fn find_storages_with_template(
&self,
template_id: Uuid
) -> CatlibResult<Vec<Storage>>
Return Storages that were created using given template_id UUID.
Errors
- Returns
CatlibError::NoRecordsFoundif noForestwas found. - Returns
CatlibError::MalformedDatabaseEntryif more than oneForestwas found.
sourcepub fn find_containers_with_template(
&self,
template_id: Uuid
) -> CatlibResult<Vec<Container>>
pub fn find_containers_with_template(
&self,
template_id: Uuid
) -> CatlibResult<Vec<Container>>
Return Containers that were created using given template_id UUID.
Errors
- Returns
CatlibError::NoRecordsFoundif noForestwas found. - Returns
CatlibError::MalformedDatabaseEntryif more than oneForestwas found.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for CatLib
impl !Send for CatLib
impl !Sync for CatLib
impl Unpin for CatLib
impl UnwindSafe for CatLib
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more