pub struct Forest { /* private fields */ }

Implementations§

source§

impl Forest

source

pub fn new( forest_manifest: Arc<dyn ForestManifest>, identity: ForestIdentity ) -> Self

source

pub fn get_storage_templates(&self) -> CatlibResult<Vec<StorageTemplate>>

Returns vector of forest’s storage templates

source

pub fn save_storage_template( &self, storage_template: StorageTemplate ) -> CatlibResult<(Uuid, StorageTemplate)>

source

pub fn forest_manifest(&self) -> Arc<dyn ForestManifest>

source

pub fn identity(&self) -> &ForestIdentity

source

pub fn create_container( &self, container_name: String, storage_template: &StorageTemplate, path: ContainerPath, encrypted: bool, metadata: Vec<u8> ) -> Result<Container, CoreXError>

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 name1".to_owned(), &storage_template, path, false, "".into()).unwrap();
source

pub fn find_containers( &self, filter: Option<CatlibContainerFilter> ) -> Result<Vec<Container>, CatlibError>

source

pub fn add_device( &mut self, device: WildlandPubKey ) -> Result<bool, CatlibError>

Errors

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

source

pub fn delete_device(&self, device: WildlandPubKey) -> Result<bool, CatlibError>

Errors

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

source

pub fn devices(&mut self) -> Result<Devices, CatlibError>

Gets the current collection of the Forest’s devices.

Errors

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

source

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

Errors

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

source

pub fn owner(&self) -> WildlandPubKey

Trait Implementations§

source§

impl Clone for Forest

source§

fn clone(&self) -> Forest

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 Forest

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Forest

§

impl Send for Forest

§

impl Sync for Forest

§

impl Unpin for Forest

§

impl !UnwindSafe for Forest

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