Setup initial db session.

This commit is contained in:
Jeff Baskin 2023-03-24 08:00:48 -04:00
parent 40aae3ef5a
commit c75bea3913
2 changed files with 39 additions and 5 deletions

View File

@ -1,15 +1,14 @@
mod database; mod database;
mod entry; mod entry;
mod error; mod error;
mod session;
mod store; mod store;
use async_std::{ use async_std::path::PathBuf;
fs::{write},
path::PathBuf,
};
use database::Database; use database::Database;
use entry::Entry; use entry::Entry;
use error::{DBError, ErrorCode}; use error::{DBError, ErrorCode};
use session::Session;
use std::{slice, str}; use std::{slice, str};
use store::Store; use store::Store;
@ -135,6 +134,10 @@ impl MoreThanText {
} }
} }
} }
fn new_session(&self) -> Session {
Session::new()
}
} }
#[cfg(test)] #[cfg(test)]
@ -297,8 +300,9 @@ mod datatype_file {
} }
#[cfg(test)] #[cfg(test)]
mod cache { mod create {
use super::*; use super::*;
use async_std::fs::write;
use std::error::Error; use std::error::Error;
use tempfile::tempdir; use tempfile::tempdir;
@ -363,3 +367,16 @@ mod cache {
} }
} }
} }
#[cfg(test)]
mod sessions {
use super::*;
use tempfile::tempdir;
#[async_std::test]
async fn create_session() {
let dir = tempdir().unwrap();
let mtt = MoreThanText::new(dir.path().to_str().unwrap()).await.unwrap();
mtt.new_session();
}
}

View File

@ -0,0 +1,17 @@
pub struct Session;
impl Session {
pub fn new() -> Self {
Self {}
}
}
#[cfg(test)]
mod session {
use super::*;
#[test]
fn create() {
Session::new();
}
}