Compare commits
2 Commits
ecfc8fdf90
...
a23b5d467e
Author | SHA1 | Date | |
---|---|---|---|
a23b5d467e | |||
c8b93d9922 |
36
src/morethantext/database-old.rs
Normal file
36
src/morethantext/database-old.rs
Normal file
@ -0,0 +1,36 @@
|
||||
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())
|
||||
}
|
||||
}
|
@ -1,36 +1,18 @@
|
||||
use super::{DBError, FileData, SessionData};
|
||||
use std::slice;
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Database;
|
||||
|
||||
impl Database {
|
||||
pub fn new() -> Self {
|
||||
Self
|
||||
fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl FileData<Self> for Database {
|
||||
fn to_bytes(&self) -> Vec<u8> {
|
||||
let output = Vec::new();
|
||||
output
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod dbase {
|
||||
use super::*;
|
||||
|
||||
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())
|
||||
#[test]
|
||||
fn create_new() {
|
||||
Database::new();
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
mod cache;
|
||||
mod database;
|
||||
mod error;
|
||||
mod store;
|
||||
|
||||
@ -8,6 +9,7 @@ use async_std::{
|
||||
task::spawn,
|
||||
};
|
||||
use cache::Cache;
|
||||
use database::Database;
|
||||
use error::{ErrorCode, MTTError};
|
||||
use store::Store;
|
||||
|
||||
|
@ -1,9 +1,16 @@
|
||||
use super::{Data, Database};
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Store;
|
||||
pub struct Store {
|
||||
data: HashMap<String, Data<Database>>,
|
||||
}
|
||||
|
||||
impl Store {
|
||||
pub fn new() -> Self {
|
||||
Self {}
|
||||
Self {
|
||||
data: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn list(&self) -> Vec<String> {
|
||||
|
Loading…
Reference in New Issue
Block a user