Setup store to hold databases.

This commit is contained in:
Jeff Baskin 2023-06-22 11:08:40 -04:00
parent c8b93d9922
commit a23b5d467e
3 changed files with 29 additions and 2 deletions

View File

@ -0,0 +1,18 @@
#[derive(Clone, Debug)]
pub struct Database;
impl Database {
fn new() -> Self {
Self {}
}
}
#[cfg(test)]
mod dbase {
use super::*;
#[test]
fn create_new() {
Database::new();
}
}

View File

@ -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;

View File

@ -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> {