pub trait ContainerManifest: Debug + Send + Sync {
// Required methods
fn version(&self) -> u64;
fn get_storages(&self) -> CatlibResult<Vec<Vec<u8>>>;
fn add_storage(&self, storage: Vec<u8>) -> CatlibResult<()>;
fn overwrite_storages(&self, storages: Vec<Vec<u8>>) -> CatlibResult<()>;
fn delete(&self) -> CatlibResult<()>;
fn forest(&self) -> CatlibResult<Arc<dyn ForestManifest>>;
fn uuid(&self) -> Uuid;
fn change_path(&self, path: ContainerPath) -> CatlibResult<()>;
fn get_path(&self) -> CatlibResult<ContainerPath>;
fn owner(&self) -> CatlibResult<WildlandPubKey>;
fn data(&self) -> CatlibResult<Vec<u8>>;
fn set_data(&self, data: Vec<u8>) -> CatlibResult<()>;
}
Expand description
ContainerManifest
trait is an API providing methods needed to manipulate container’s
configuration 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 get_storages(&self) -> CatlibResult<Vec<Vec<u8>>>
fn get_storages(&self) -> CatlibResult<Vec<Vec<u8>>>
Lists the storages that the given container use in order to keep the data.
sourcefn add_storage(&self, storage: Vec<u8>) -> CatlibResult<()>
fn add_storage(&self, storage: Vec<u8>) -> CatlibResult<()>
This operation adds a given Storage Backend to the container. The procedure involves starting the data sync mechanism between the new storage and the other present storages.
Container can have multiple storages. Given container should has exact copies of the data on every storage.
sourcefn overwrite_storages(&self, storages: Vec<Vec<u8>>) -> CatlibResult<()>
fn overwrite_storages(&self, storages: Vec<Vec<u8>>) -> CatlibResult<()>
Overwrites the storages of a container
Storages vector cannot be empty
sourcefn delete(&self) -> CatlibResult<()>
fn delete(&self) -> CatlibResult<()>
Deletes all records regarding the container from the database.
sourcefn forest(&self) -> CatlibResult<Arc<dyn ForestManifest>>
fn forest(&self) -> CatlibResult<Arc<dyn ForestManifest>>
Return crate::Forest
that contains the crate::Container
.
sourcefn change_path(&self, path: ContainerPath) -> CatlibResult<()>
fn change_path(&self, path: ContainerPath) -> CatlibResult<()>
Overrides container path.
sourcefn get_path(&self) -> CatlibResult<ContainerPath>
fn get_path(&self) -> CatlibResult<ContainerPath>
Get path from the given container.
sourcefn owner(&self) -> CatlibResult<WildlandPubKey>
fn owner(&self) -> CatlibResult<WildlandPubKey>
Retrieve Forest’s owner identity
sourcefn data(&self) -> CatlibResult<Vec<u8>>
fn data(&self) -> CatlibResult<Vec<u8>>
Retrieves containers arbitrary metadata