Trait wildland_corex::catlib_service::entities::ForestManifest
source · 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§
fn version(&self) -> u64
sourcefn add_device(
&self,
device: WildlandPubKey,
encrypted_fek: Vec<u8>
) -> CatlibResult<bool>
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.
sourcefn delete_device(&self, device: WildlandPubKey) -> CatlibResult<bool>
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.
sourcefn find_containers(
&self,
filters: Option<CatlibContainerFilter>
) -> CatlibResult<Vec<Arc<dyn ContainerManifest>>>
fn find_containers( &self, filters: Option<CatlibContainerFilter> ) -> CatlibResult<Vec<Arc<dyn ContainerManifest>>>
Return list of Forest Containers
sourcefn delete(&self) -> CatlibResult<bool>
fn delete(&self) -> CatlibResult<bool>
Delete Forest
WARN: The underlying objects are not removed recursively
sourcefn create_container(
&self,
container_uuid: Uuid,
data: Vec<u8>,
path: ContainerPath,
storages: Vec<Storage>
) -> CatlibResult<Arc<dyn ContainerManifest>>
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
sourcefn data(&self) -> CatlibResult<Vec<u8>>
fn data(&self) -> CatlibResult<Vec<u8>>
Retrieve Forest’s metadata
sourcefn owner(&self) -> WildlandPubKey
fn owner(&self) -> WildlandPubKey
Retrieve Forest’s owner identity
sourcefn devices(&self) -> CatlibResult<Devices>
fn devices(&self) -> CatlibResult<Devices>
Retrieve Forests’s devices
sourcefn get_storage_templates(&self) -> CatlibResult<Vec<(Uuid, Vec<u8>)>>
fn get_storage_templates(&self) -> CatlibResult<Vec<(Uuid, Vec<u8>)>>
Fetch every Storage Template from the forest.
sourcefn save_storage_template(
&self,
template_id: Option<Uuid>,
value: Vec<u8>
) -> CatlibResult<Uuid>
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.