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;
impl Database {
fn new() -> Self {
Self {}
pub fn new() -> Self {
Self
}
}
#[cfg(test)]
mod dbase {
use super::*;
impl FileData<Self> for Database {
fn to_bytes(&self) -> Vec<u8> {
let output = Vec::new();
output
}
#[test]
fn create_new() {
Database::new();
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,5 +1,4 @@
mod cache;
mod database;
mod error;
mod store;
@ -9,7 +8,6 @@ use async_std::{
task::spawn,
};
use cache::Cache;
use database::Database;
use error::{ErrorCode, MTTError};
use store::Store;

View File

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