Compare commits

..

No commits in common. "a23b5d467e777ba7174eaeb4181cdbdc6fd730fa" and "ecfc8fdf90e69e074c9516e2191ed4efbdb7390c" have entirely different histories.

4 changed files with 29 additions and 56 deletions

View File

@ -1,36 +0,0 @@
use super::{DBError, FileData, SessionData};
use std::slice;
#[derive(Clone)]
pub struct Database;
impl Database {
pub fn new() -> Self {
Self
}
}
impl FileData<Self> for Database {
fn to_bytes(&self) -> Vec<u8> {
let output = Vec::new();
output
}
fn from_bytes(_data: &mut slice::Iter<u8>) -> Result<Self, DBError> {
Ok(Self {})
}
}
impl SessionData for Database {
fn add(&mut self, _key: &str, _value: &str, _data: &str) -> Result<Vec<String>, DBError> {
Ok(Vec::new())
}
fn eq(&self, _key: &str, _value: &str) -> Result<Vec<String>, DBError> {
Ok(Vec::new())
}
fn list(&self, _keys: Vec<&str>) -> Result<Vec<String>, DBError> {
Ok(Vec::new())
}
}

View File

@ -1,18 +1,36 @@
#[derive(Clone, Debug)] use super::{DBError, FileData, SessionData};
use std::slice;
#[derive(Clone)]
pub struct Database; pub struct Database;
impl Database { impl Database {
fn new() -> Self { pub fn new() -> Self {
Self {} Self
} }
} }
#[cfg(test)] impl FileData<Self> for Database {
mod dbase { fn to_bytes(&self) -> Vec<u8> {
use super::*; let output = Vec::new();
output
}
#[test] fn from_bytes(_data: &mut slice::Iter<u8>) -> Result<Self, DBError> {
fn create_new() { Ok(Self {})
Database::new(); }
}
impl SessionData for Database {
fn add(&mut self, _key: &str, _value: &str, _data: &str) -> Result<Vec<String>, DBError> {
Ok(Vec::new())
}
fn eq(&self, _key: &str, _value: &str) -> Result<Vec<String>, DBError> {
Ok(Vec::new())
}
fn list(&self, _keys: Vec<&str>) -> Result<Vec<String>, DBError> {
Ok(Vec::new())
} }
} }

View File

@ -1,5 +1,4 @@
mod cache; mod cache;
mod database;
mod error; mod error;
mod store; mod store;
@ -9,7 +8,6 @@ use async_std::{
task::spawn, task::spawn,
}; };
use cache::Cache; use cache::Cache;
use database::Database;
use error::{ErrorCode, MTTError}; use error::{ErrorCode, MTTError};
use store::Store; use store::Store;

View File

@ -1,16 +1,9 @@
use super::{Data, Database};
use std::collections::HashMap;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Store { pub struct Store;
data: HashMap<String, Data<Database>>,
}
impl Store { impl Store {
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {}
data: HashMap::new(),
}
} }
pub fn list(&self) -> Vec<String> { pub fn list(&self) -> Vec<String> {