Crate wildland_catlib
source · [−]Expand description
Catalog client library
This library is used by Wildland Core to allow persistent storage for Wildland manifests that describe Wildland entities such as Containers, Storages, Bridges etc.
The library acts as a database client depending on the database backend used. The current version of CatLib stores manifests in a local single-file nosql, unstructured database. Location of the database file depends on the platform where the application runs, these are:
Linux: /home/alice/.config/catlib
Windows: C:\Users\Alice\AppData\Roaming\com.wildland.Cargo\catlib
macOS: /Users/Alice/Library/Application Support/com.wildland.Cargo/catlib
Entities relationship
+------------+ +------------+
| Forest | -------> | Bridge |
+------------+ +------------+
|
| +-------------+
+-----> | Container |
+-------------+
|
| +-----------+
+-----> | Storage |
+-----------+
Example usage
let forest_owner = Identity([1; 32]);
let signer = Identity([2; 32]);
let catlib = CatLib::default();
let forest = catlib.create_forest(
forest_owner,
HashSet::from([signer]),
vec![],
).unwrap();
let mut container = forest.create_container().unwrap();
container.add_path("/foo/bar".to_string());
container.add_path("/bar/baz".to_string());
let storage_template_id = Uuid::from_u128(1);
let storage_data = b"credentials_and_whatnot".to_vec();
container.create_storage(Some(storage_template_id), storage_data);
Re-exports
pub use contracts::*;