From a23b5d467e777ba7174eaeb4181cdbdc6fd730fa Mon Sep 17 00:00:00 2001 From: Jeff Baskin Date: Thu, 22 Jun 2023 11:08:40 -0400 Subject: [PATCH] Setup store to hold databases. --- src/morethantext/database.rs | 18 ++++++++++++++++++ src/morethantext/mod.rs | 2 ++ src/morethantext/store.rs | 11 +++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/morethantext/database.rs diff --git a/src/morethantext/database.rs b/src/morethantext/database.rs new file mode 100644 index 0000000..d771296 --- /dev/null +++ b/src/morethantext/database.rs @@ -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(); + } +} diff --git a/src/morethantext/mod.rs b/src/morethantext/mod.rs index 4ab55ea..e6f229f 100644 --- a/src/morethantext/mod.rs +++ b/src/morethantext/mod.rs @@ -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; diff --git a/src/morethantext/store.rs b/src/morethantext/store.rs index 14947ac..f619f13 100644 --- a/src/morethantext/store.rs +++ b/src/morethantext/store.rs @@ -1,9 +1,16 @@ +use super::{Data, Database}; +use std::collections::HashMap; + #[derive(Clone, Debug)] -pub struct Store; +pub struct Store { + data: HashMap>, +} impl Store { pub fn new() -> Self { - Self {} + Self { + data: HashMap::new(), + } } pub fn list(&self) -> Vec {