aboutsummaryrefslogtreecommitdiff
path: root/lockchain-files/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lockchain-files/src/lib.rs')
-rw-r--r--lockchain-files/src/lib.rs32
1 files changed, 25 insertions, 7 deletions
diff --git a/lockchain-files/src/lib.rs b/lockchain-files/src/lib.rs
index 320714b..97912be 100644
--- a/lockchain-files/src/lib.rs
+++ b/lockchain-files/src/lib.rs
@@ -55,16 +55,19 @@ extern crate serde_derive;
extern crate serde;
use lcc::traits::{Body, LoadRecord, Vault};
-use lcc::{users::Token, MetaDomain, Payload, Record, VaultMetadata};
+use lcc::{
+ initialise::Generator,
+ users::{Access, Token},
+ MetaDomain, Payload, Record, VaultMetadata,
+};
use std::collections::HashMap;
+mod config;
mod fs;
mod utils;
-mod config;
+pub use config::{ConfigError, VaultConfig};
use fs::{FileType, Filesystem};
-pub use config::{VaultConfig, ConfigError};
-
/// Persistence mapper to a folder and file structure
///
@@ -112,16 +115,31 @@ impl<T: Body> DataVault<T> {
impl<T: Body> LoadRecord<T> for DataVault<T> {}
impl<T: Body> Vault<T> for DataVault<T> {
- fn new(name: &str, location: &str) -> DataVault<T> {
+ fn new(gen: Generator) -> DataVault<T> {
Self {
- meta_info: (name.into(), location.into()),
+ meta_info: (
+ gen.name.clone().unwrap().into(),
+ gen.location.clone().unwrap().into(),
+ ),
records: HashMap::new(),
config: VaultConfig::new(),
metadata: HashMap::new(),
- fs: Filesystem::new(location, name),
+ fs: Filesystem::new(&gen.location.unwrap(), &gen.name.unwrap()),
}.initialize()
}
+ fn create_user(
+ &mut self,
+ token: Token,
+ username: &str,
+ secret: &str,
+ access: Vec<Access>,
+ ) -> Result<(), ()> {
+ unimplemented!()
+ }
+
+ fn delete_user(&mut self, token: Token, username: &str) {}
+
// Checking if a vault exists is basically checking it's config
// against the compatible version of this library.
//