aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2018-09-15 20:47:08 +0100
committerKatharina Fey <kookie@spacekookie.de>2018-09-15 20:47:08 +0100
commit95f68641e61fb633eb4f588160572b5e0371e139 (patch)
treef3f0c132cfb769542576c6d9cb875157f06fa2e5
parent87cb39050d938e01b7b26633dab3d141737330ed (diff)
Restructuring internal layout and working on Generator intergration
-rw-r--r--lockchain-files/src/create.rs11
-rw-r--r--lockchain-files/src/lib.rs62
-rw-r--r--lockchain-files/src/storage.rs2
3 files changed, 21 insertions, 54 deletions
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<T: Body> FileVault<T> {
/// A small utility to create a new file vault
@@ -17,7 +16,7 @@ impl<T: Body> FileVault<T> {
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<T: Body> FileVault<T> {
}
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/
-//! <base64 hash 1>.rec
-//! <base64 hash 2>.rec
-//! <base64 hash 3>.rec
-//! hashsums/
-//! <base64 hash 1>.sum
-//! <base64 hash 2>.sum
-//! <base64 hash 3>.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<T: Body> Vault<T> for FileVault<T> {
}
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`
+