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::NoRecordsFound
if noForest
was found. - Returns
CatlibError::MalformedDatabaseEntry
if more than oneForest
was 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 Storage
s that were created using given template_id
UUID.
Errors
- Returns
CatlibError::NoRecordsFound
if noForest
was found. - Returns
CatlibError::MalformedDatabaseEntry
if more than oneForest
was 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 Container
s that were created using given template_id
UUID.
Errors
- Returns
CatlibError::NoRecordsFound
if noForest
was found. - Returns
CatlibError::MalformedDatabaseEntry
if more than oneForest
was 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