diff options
author | Katharina Fey <kookie@spacekookie.de> | 2018-09-15 22:46:39 +0100 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2018-09-15 22:58:19 +0100 |
commit | a0f9a5bb2a294674a28fc8ad38deb11d9bf9ecb1 (patch) | |
tree | 56ba7f22c2b7678a91b6b1bd8fc4d1184b1da69e /lockchain-files/src/fs/primitive.rs | |
parent | ffafddfcbd07be8951701c3299407999928baddc (diff) |
A large batch of refactoring in FileVault
Okay what am I doing here? If you're reading this in the future,
it probably means I made some bad decisions. First: I'm sorry.
Secondly: let me explain why I did what I did...
Until this point `FileVault` has been a very transparent structure.
It didn't really interact with the data much, basically solving all
fs operations with streamed iterators and making sure stuff was done
correctly, but not adding any depth on top of that.
This needed to change...
This isn't quite done and most of the code just breaks here ;)
But the idea is to have `FileVault` be an intelligent wrapper around
the filesystem. That means that not only does it cache certain
operations for speed, it also keeps a selective index of files
that exist. So for example, `Headers` were added here, that are
always kept in sync with the FS. But only certain Records are stored
(not only for security but also size consearns).
After this refactoring is done (I shall write another long commit)
the FileVault will act more as it's own type than just a simple,
linear `Vault<T>` implementation.
Diffstat (limited to 'lockchain-files/src/fs/primitive.rs')
-rw-r--r-- | lockchain-files/src/fs/primitive.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lockchain-files/src/fs/primitive.rs b/lockchain-files/src/fs/primitive.rs new file mode 100644 index 0000000..3723232 --- /dev/null +++ b/lockchain-files/src/fs/primitive.rs @@ -0,0 +1,34 @@ +//! Very simple file system primitives + +#![allow(dead_code)] + +/// A set of files that exist inside a `FileVault` +pub enum FileType { + /// A data record file + Record, + /// A MetaDomain file + Metadata, + /// A simple checksum file + Checksum, + /// _The_ config file + Config, + #[doc(hidden)] + __NonExhaustive, +} + +/// Construct a file ending for a specific match result +macro_rules! file_ending { + ($type:expr) => { + match $type { + FileType::Record => "record", + FileType::Metadata => "meta", + FileType::Checksum => "sum", + FileType::Config => "cfg" + _ => "dat", + } + }; +} + +pub fn write_file(tt: FileType) {} + +pub fn read_file() {} |