Struct wildland_corex::container::Container
source · pub struct Container { /* private fields */ }
Implementations§
source§impl Container
impl Container
pub fn new(container_manifest: Arc<dyn ContainerManifest>) -> Self
sourcepub fn change_path(&self, path: String) -> Result<(), CatlibError>
pub fn change_path(&self, path: String) -> Result<(), CatlibError>
Errors
Returns RedisError
cast on crate::catlib_service::error::CatlibResult
upon failure to save to the database.
Example
let catlib = GqlCatlib::new("http://localhost:8000/graphql/");
let forest = catlib.create_forest(
WildlandPubKey([1; 32]),
HashMap::from([(WildlandPubKey([2; 32]), "".into())]),
vec![],
).unwrap();
let forest = Forest::new(forest, ForestIdentity::new(0, SigningKeypair::try_from_bytes_slices([0;32], [0;32]).unwrap()));
let storage_template = StorageTemplate::new(
"template type",
ValidatedTemplateData(
serde_json::to_value(
HashMap::from(
[
(
"field1".to_owned(),
"Some value with container name: {{ CONTAINER_NAME }}".to_owned(),
),
(
"parameter in key: {{ OWNER }}".to_owned(),
"enum: {{ ACCESS_MODE }}".to_owned(),
),
("uuid".to_owned(), "{{ CONTAINER_UUID }}".to_owned()),
("path".to_owned(), "{{ PATH }}".to_owned()),
]
)
).unwrap()),
None,
);
let path = "/some/path".into();
let container = forest.create_container("container name2".to_owned(), &storage_template, path, false, "".into()).unwrap();
sourcepub fn get_path(&self) -> Result<String, CatlibError>
pub fn get_path(&self) -> Result<String, CatlibError>
Returns the current claimed path claimed by the given container.
Errors
Returns RedisError
cast on crate::catlib_service::error::CatlibResult
upon failure to save to the database.
sourcepub fn add_storage(
&mut self,
template_uuid: Option<Uuid>,
rendered_storage: RenderedStorage,
encrypted: bool
) -> Result<Storage, CatlibError>
pub fn add_storage( &mut self, template_uuid: Option<Uuid>, rendered_storage: RenderedStorage, encrypted: bool ) -> Result<Storage, CatlibError>
Errors
- Returns
CatlibError::NoRecordsFound
if noContainer
was found.
sourcepub fn remove_storage(&mut self, uuid: &Uuid) -> Result<(), CoreXError>
pub fn remove_storage(&mut self, uuid: &Uuid) -> Result<(), CoreXError>
Errors
- Returns
CatlibError::NoRecordsFound
if no storage was found.
pub fn render_template( &self, storage_template: &StorageTemplate ) -> Result<RenderedStorage, StorageTemplateError>
sourcepub fn get_storages(&self) -> Result<Vec<Storage>, CoreXError>
pub fn get_storages(&self) -> Result<Vec<Storage>, CoreXError>
Errors
Returns CatlibError::NoRecordsFound
if Forest has no crate::Storage
.
sourcepub fn set_name(&self, name: String) -> Result<(), CatlibError>
pub fn set_name(&self, name: String) -> Result<(), CatlibError>
Updates a tet name of the given container.
Errors
Returns RedisError
cast on crate::catlib_service::error::CatlibResult
upon failure to save to the database.
sourcepub fn name(&self) -> Result<String, CatlibError>
pub fn name(&self) -> Result<String, CatlibError>
Get the container’s name
sourcepub fn remove(&self) -> Result<(), CatlibError>
pub fn remove(&self) -> Result<(), CatlibError>
Errors
Returns RedisError
cast on crate::catlib_service::error::CatlibResult
upon failure to save to the database.
pub fn metadata(&self) -> Result<Vec<u8>, CatlibError>
pub fn set_metadata(&self, metadata: Vec<u8>) -> Result<(), CatlibError>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Container
impl Send for Container
impl Sync for Container
impl Unpin for Container
impl !UnwindSafe for Container
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more