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}; | #[derive(Clone, Debug)] | ||||||
| use std::slice; |  | ||||||
|  |  | ||||||
| #[derive(Clone)] |  | ||||||
| pub struct Database; | pub struct Database; | ||||||
|  |  | ||||||
| impl Database { | impl Database { | ||||||
|     pub fn new() -> Self { |     fn new() -> Self { | ||||||
|         Self |         Self {} | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| impl FileData<Self> for Database { | #[cfg(test)] | ||||||
|     fn to_bytes(&self) -> Vec<u8> { | mod dbase { | ||||||
|         let output = Vec::new(); |     use super::*; | ||||||
|         output |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     fn from_bytes(_data: &mut slice::Iter<u8>) -> Result<Self, DBError> { |     #[test] | ||||||
|         Ok(Self {}) |     fn create_new() { | ||||||
|     } |         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()) |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,4 +1,5 @@ | |||||||
| mod cache; | mod cache; | ||||||
|  | mod database; | ||||||
| mod error; | mod error; | ||||||
| mod store; | mod store; | ||||||
|  |  | ||||||
| @@ -8,6 +9,7 @@ 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; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,9 +1,16 @@ | |||||||
|  | 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> { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user