pub trait IForest {
Show 13 methods fn uuid(&self) -> Uuid; fn owner(&self) -> Identity; fn signers(&self) -> HashSet<Identity, RandomState>; fn data(&self) -> Vec<u8, Global>; fn add_signer(&mut self, signer: Identity) -> Result<bool, CatlibError>; fn del_signer(&mut self, signer: Identity) -> Result<bool, CatlibError>; fn containers(&self) -> Result<Vec<Container, Global>, CatlibError>; fn update(&mut self, data: Vec<u8, Global>) -> Result<(), CatlibError>; fn remove(&mut self) -> Result<bool, CatlibError>; fn create_container(&self) -> Result<Container, CatlibError>; fn create_bridge(
        &self,
        path: String,
        link_data: Vec<u8, Global>
    ) -> Result<Bridge, CatlibError>; fn find_bridge(&self, path: String) -> Result<Bridge, CatlibError>; fn find_containers(
        &self,
        paths: Vec<String, Global>,
        include_subdirs: bool
    ) -> Result<Vec<Container, Global>, CatlibError>;
}

Required Methods

Return UUID object identifier

Return Forest owner

Return list of manifests Signers

Return Forest arbitrary data

Add manifest Signer

Returns whether the value was newly inserted. That is:

  • If the signer did not previously exist, true is returned.
  • If the signer already exists, false is returned.
Errors

Returns RustbreakError cast on CatlibResult upon failure to save to the database.

Delete manifest Signer

Returns whether the value was already present. That is:

  • If the signer did not previously exist, false is returned.
  • If the signer existed in the set, true is returned.
Errors

Returns RustbreakError cast on CatlibResult upon failure to save to the database.

Return list of Forest Containers

Errors

Returns CatlibError::NoRecordsFound if Forest has no Container.

Set Forest arbitrary data

Errors

Returns RustbreakError cast on CatlibResult upon failure to save to the database.

Delete Forest from the database

WARN: The underlying objects are not removed recursively

Errors

Returns RustbreakError cast on CatlibResult upon failure to save to the database.

Create an empty container, bound to the Forest.

To set container paths, use Container::add_path

Errors

Returns RustbreakError cast on CatlibResult upon failure to save to the database.

Example
let catlib = CatLib::default();
let forest = catlib.create_forest(
                 Identity([1; 32]),
                 HashSet::from([Identity([2; 32])]),
                 vec![],
             ).unwrap();
let mut container = forest.create_container().unwrap();
container.add_path("/foo/bar".to_string());
container.add_path("/bar/baz".to_string());

Create a Bridge obect with arbitrary link data to another Forest.

The aforementioned link data will be defined by the D/FS module.

Errors

Returns RustbreakError cast on CatlibResult upon failure to save to the database.

Example
let catlib = CatLib::default();
let forest = catlib.create_forest(
                 Identity([1; 32]),
                 HashSet::from([Identity([2; 32])]),
                 vec![],
             ).unwrap();
forest.create_bridge("/other/forest".to_string(), vec![]);

Return bridge that matches the given ContainerPath.

Errors

Retrieve Containers that match given ContainerPaths.

If include_subdirs is true, then the ContainerPaths are treated as Path prefixes and not absolute paths.

Errors
Example
use wildland_catlib::CatLib;
use std::collections::HashSet;
use crate::wildland_catlib::*;

let catlib = CatLib::default(); let forest = catlib.create_forest( b“owner“.to_vec(), HashSet::from([b“signer“.to_vec()]), vec![], ).unwrap(); let mut container = forest.create_container().unwrap(); container.add_path(“/foo/bar”.to_string());

let containers = forest.find_containers(vec![“/foo/bar”.to_string()], false).unwrap();

Implementors