pub trait ForestManifest: Debug + Send + Sync {
    // Required methods
    fn version(&self) -> u64;
    fn add_device(
        &self,
        device: WildlandPubKey,
        encrypted_fek: Vec<u8>
    ) -> CatlibResult<bool>;
    fn delete_device(&self, device: WildlandPubKey) -> CatlibResult<bool>;
    fn find_containers(
        &self,
        filters: Option<CatlibContainerFilter>
    ) -> CatlibResult<Vec<Arc<dyn ContainerManifest>>>;
    fn delete(&self) -> CatlibResult<bool>;
    fn create_container(
        &self,
        container_uuid: Uuid,
        data: Vec<u8>,
        path: ContainerPath,
        storages: Vec<Storage>
    ) -> CatlibResult<Arc<dyn ContainerManifest>>;
    fn set_data(&self, data: Vec<u8>) -> CatlibResult<()>;
    fn data(&self) -> CatlibResult<Vec<u8>>;
    fn owner(&self) -> WildlandPubKey;
    fn devices(&self) -> CatlibResult<Devices>;
    fn get_storage_templates(&self) -> CatlibResult<Vec<(Uuid, Vec<u8>)>>;
    fn save_storage_template(
        &self,
        template_id: Option<Uuid>,
        value: Vec<u8>
    ) -> CatlibResult<Uuid>;
}
Expand description

ForestManifest trait is an API providing methods needed to operate on the forest’s state. It should be implemented by Cat-Lib instance and should be treated as a kind of a proxy layer between Wildland Core and the external persistent data storage instance (for e.g. database).

Required Methods§

source

fn version(&self) -> u64

source

fn add_device( &self, device: WildlandPubKey, encrypted_fek: Vec<u8> ) -> CatlibResult<bool>

Add manifest Device (pubkey with Forest Encryption Key encrypted with this key)

Returns whether the value was newly inserted. That is:

  • If the device did not previously exist, true is returned.
  • If the device already exists, false is returned.
source

fn delete_device(&self, device: WildlandPubKey) -> CatlibResult<bool>

Delete manifest Signer

Returns whether the value was already present. That is:

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

fn find_containers( &self, filters: Option<CatlibContainerFilter> ) -> CatlibResult<Vec<Arc<dyn ContainerManifest>>>

Return list of Forest Containers

source

fn delete(&self) -> CatlibResult<bool>

Delete Forest

WARN: The underlying objects are not removed recursively

source

fn create_container( &self, container_uuid: Uuid, data: Vec<u8>, path: ContainerPath, storages: Vec<Storage> ) -> CatlibResult<Arc<dyn ContainerManifest>>

Create an empty container, bound to the Forest.

To set container path, use crate::Container::change_path

source

fn set_data(&self, data: Vec<u8>) -> CatlibResult<()>

Set Forest arbitrary data

source

fn data(&self) -> CatlibResult<Vec<u8>>

Retrieve Forest’s metadata

source

fn owner(&self) -> WildlandPubKey

Retrieve Forest’s owner identity

source

fn devices(&self) -> CatlibResult<Devices>

Retrieve Forests’s devices

source

fn get_storage_templates(&self) -> CatlibResult<Vec<(Uuid, Vec<u8>)>>

Fetch every Storage Template from the forest.

source

fn save_storage_template( &self, template_id: Option<Uuid>, value: Vec<u8> ) -> CatlibResult<Uuid>

Save StorageTemplate data in CatLib.

It creates a new record if template_id is None.

Returns uuid of the saved template.

Implementors§