Add storage/backend setup

This commit is contained in:
Matthias Beyer 2015-11-10 19:27:54 +01:00
parent e73701ace4
commit f4dbec72ee
3 changed files with 56 additions and 1 deletions

View file

@ -6,7 +6,8 @@ use std::fmt::Display;
use std::path::Path; use std::path::Path;
use std::result::Result; use std::result::Result;
use storage::backend::*; use storage::backend::{StorageBackend, StorageBackendError};
mod command;
#[derive(Debug)] #[derive(Debug)]
pub struct ModuleError { pub struct ModuleError {

53
src/storage/backend.rs Normal file
View file

@ -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 {
}

View file

@ -6,6 +6,7 @@ pub use runtime::Runtime;
pub mod file; pub mod file;
pub mod parser; pub mod parser;
pub mod backend;
pub mod json; pub mod json;