From f4dbec72eefc7b678d72bfa498f89340e81f72cd Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 10 Nov 2015 19:27:54 +0100 Subject: [PATCH] Add storage/backend setup --- src/module/mod.rs | 3 ++- src/storage/backend.rs | 53 ++++++++++++++++++++++++++++++++++++++++++ src/storage/mod.rs | 1 + 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/storage/backend.rs diff --git a/src/module/mod.rs b/src/module/mod.rs index 859e85da..af86ce91 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -6,7 +6,8 @@ use std::fmt::Display; use std::path::Path; use std::result::Result; -use storage::backend::*; +use storage::backend::{StorageBackend, StorageBackendError}; +mod command; #[derive(Debug)] pub struct ModuleError { diff --git a/src/storage/backend.rs b/src/storage/backend.rs new file mode 100644 index 00000000..dfced8f5 --- /dev/null +++ b/src/storage/backend.rs @@ -0,0 +1,53 @@ +use std::error::Error; +use std::fmt::Display; + +use super::file::FileID; +use super::file::File; +use module::Module; + +type BackendOperationResult = Result<(), StorageBackendError>; + +pub struct StorageBackend<'a> { + basepath: String, + module: &'a Module, +} + +impl<'a> StorageBackend<'a> { + + fn new() -> StorageBackend<'a> { + } + + fn getFileList() -> Vec<(String, FileID)> { + } + + fn createEmpty() -> FileID { + } + + fn createFile() -> File { + } + + fn writeFile(f: File) -> BackendOperationResult { + } + + fn createFileWithContent(content: String) -> BackendOperationResult { + } + + fn readFile(id: FileID) -> String { + } + + // TODO: Meta files are not covered yet + +} + +#[derive(Debug)] +pub struct StorageBackendError; + +impl StorageBackendError { +} + +impl Error for StorageBackendError { +} + +impl Display for StorageBackendError { +} + diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 252f6001..a431b2c9 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -6,6 +6,7 @@ pub use runtime::Runtime; pub mod file; pub mod parser; +pub mod backend; pub mod json;