From 95f68641e61fb633eb4f588160572b5e0371e139 Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Sat, 15 Sep 2018 20:47:08 +0100 Subject: Restructuring internal layout and working on Generator intergration --- lockchain-files/src/create.rs | 11 +++----- lockchain-files/src/lib.rs | 62 ++++++++++-------------------------------- lockchain-files/src/storage.rs | 2 ++ 3 files changed, 21 insertions(+), 54 deletions(-) create mode 100644 lockchain-files/src/storage.rs diff --git a/lockchain-files/src/create.rs b/lockchain-files/src/create.rs index 6c5255a..aa8c0cd 100644 --- a/lockchain-files/src/create.rs +++ b/lockchain-files/src/create.rs @@ -5,10 +5,9 @@ use lcc::errors::VaultError; use lcc::{traits::Body, Generator}; use std::collections::HashMap; -use ::FileVault; -use ::config::{VaultConfig, ConfigError}; -use ::fs::{Filesystem, FileType}; - +use config::{ConfigError, VaultConfig}; +use fs::{FileType, Filesystem}; +use FileVault; impl FileVault { /// A small utility to create a new file vault @@ -17,7 +16,7 @@ impl FileVault { let fs = Filesystem::new(location, name); fs.scaffold().map_err(|_| VaultError::FailedCreation)?; - + let cfg = VaultConfig::new(&gen); // Ok(Box::new( @@ -37,8 +36,6 @@ impl FileVault { } fn get_path(gen: &Generator) -> Result<(&str, &str), VaultError> { - - Err(VaultError::IncompleteGenerator) } } diff --git a/lockchain-files/src/lib.rs b/lockchain-files/src/lib.rs index cfb097a..b9b8bd4 100644 --- a/lockchain-files/src/lib.rs +++ b/lockchain-files/src/lib.rs @@ -4,46 +4,8 @@ //! which relies on keeping records in discrete files //! and folder structures. //! -//! This is great if a vault needs to be easily syncable -//! or indexable by another tool. -//! No clear-text secrets are ever written to disk. -//! But might be held in memory cache -//! for a period of time. -//! -//! This backend is comparibly slow -//! and should be avoided -//! for performance critical applications. -//! For such applications -//! the blockstore is much more suited -//! which represents a vault -//! in a binary blob -//! independant of the used filesystem. -//! -//! Part of the performance problems -//! comes from locking the entire vault -//! when doing operations, -//! meaning that only -//! one instance -//! of a lockchain library -//! can operate on it -//! at the time -//! -//! ``` -//! my_vault/ -//! config.toml -//! Lockfile -//! metadata/ -//! userstore.meta -//! registry.meta -//! records/ -//! .rec -//! .rec -//! .rec -//! hashsums/ -//! .sum -//! .sum -//! .sum -//! ``` +//! All further documentation can be found in `FileVault` + #![feature(non_modrs_mods)] extern crate lockchain_core as lcc; @@ -75,9 +37,18 @@ use userstore::UserStoreMapper; /// Persistence mapper to a folder and file structure /// +/// This implementation tries to be as efficient +/// as possible, however please note that it is +/// dependant on filesystem operations and is +/// not suited for high-performance applications! +/// +/// --- +/// /// Implements the `Vault` API in full, /// replicating all functionality in memory -/// and never writing clear text data to disk. +/// while providing async operations on-disk. +/// +/// Requests on files are debounced! /// /// The internal layout should not be assumed /// and isn't stabilised with the crate version @@ -85,7 +56,8 @@ use userstore::UserStoreMapper; /// as long as they remain API compatible). /// /// The version of a vault is written in it's coniguration -/// (which won't change – ever). +/// which can be read via `json-compat` shims, +/// in case the layout and scheme ever changes. /// /// The vault folder is safe to copy around – /// all vault metadata is kept inside it. @@ -138,11 +110,7 @@ impl Vault for FileVault { } fn metadata(&self) -> VaultMetadata { - VaultMetadata { - name: self.meta_info.0.clone(), - location: self.meta_info.1.clone(), - size: self.records.len(), - } + unimplemented!() } /// Caches all files from disk to memory diff --git a/lockchain-files/src/storage.rs b/lockchain-files/src/storage.rs new file mode 100644 index 0000000..c935613 --- /dev/null +++ b/lockchain-files/src/storage.rs @@ -0,0 +1,2 @@ +//! Implementation details for filesystem activities such as `pull`, `fetch` and `sync` + -- cgit v1.2.3