pub struct Container { /* private fields */ }

Implementations§

source§

impl Container

source

pub fn new(container_manifest: Arc<dyn ContainerManifest>) -> Self

source

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();
source

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.

source

pub fn add_storage( &mut self, template_uuid: Option<Uuid>, rendered_storage: RenderedStorage, encrypted: bool ) -> Result<Storage, CatlibError>

Errors
source

pub fn remove_storage(&mut self, uuid: &Uuid) -> Result<(), CoreXError>

Errors
source

pub fn render_template( &self, storage_template: &StorageTemplate ) -> Result<RenderedStorage, StorageTemplateError>

source

pub fn get_storages(&self) -> Result<Vec<Storage>, CoreXError>

source

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.

source

pub fn name(&self) -> Result<String, CatlibError>

Get the container’s name

source

pub fn remove(&self) -> Result<(), CatlibError>

Errors

Returns RedisError cast on crate::catlib_service::error::CatlibResult upon failure to save to the database.

source

pub fn uuid(&self) -> Uuid

Get the container’s uuid

source

pub fn metadata(&self) -> Result<Vec<u8>, CatlibError>

source

pub fn set_metadata(&self, metadata: Vec<u8>) -> Result<(), CatlibError>

Trait Implementations§

source§

impl Clone for Container

source§

fn clone(&self) -> Container

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Container

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more