Add storage/backend setup
This commit is contained in:
parent
e73701ace4
commit
f4dbec72ee
3 changed files with 56 additions and 1 deletions
|
@ -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 {
|
||||
|
|
53
src/storage/backend.rs
Normal file
53
src/storage/backend.rs
Normal 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 {
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ pub use runtime::Runtime;
|
|||
|
||||
pub mod file;
|
||||
pub mod parser;
|
||||
pub mod backend;
|
||||
|
||||
pub mod json;
|
||||
|
||||
|
|
Loading…
Reference in a new issue