diff --git a/dblib/src/lib.rs b/dblib/src/lib.rs index ba3c3a6..9d27441 100644 --- a/dblib/src/lib.rs +++ b/dblib/src/lib.rs @@ -6,6 +6,7 @@ use serde::{Serialize, Deserialize}; pub mod request; pub mod keystore; +pub mod videostore; pub mod err; use request::ApiKey; @@ -25,15 +26,22 @@ fn dev_urandom() -> std::io::Result { #[derive(Serialize, Deserialize)] pub struct VideoMeta { - pub id: u64, - pub string: String, + pub id: String, + pub name: String, + pub desc: Option +} + +#[derive(Serialize, Deserialize)] +struct VideoMetaEntry { + pub name: String, pub desc: Option } #[derive(Serialize, Deserialize)] pub struct DB { keys: Vec, - videos: HashMap + // We map the video meta id to its actual body content + videos: HashMap } // TODO: add some proper lifetime management here and some docs @@ -46,8 +54,8 @@ pub trait KeyStore { pub trait VideoStore { fn new_video(name: &str, desc: &str) -> err::Result<()>; - fn del_video(id: u64) -> err::Result<()>; - fn get_video(id: Option, name: Option<&str>) -> err::Result; - fn rename_video(id: u64, new: &str) -> err::Result<()>; - fn redescribe_video(id: u64, new: &str) -> err::Result<()>; + fn del_video(id: String) -> err::Result<()>; + fn get_video(id: Option, name: Option<&str>) -> err::Result; + fn rename_video(id: String, new: &str) -> err::Result<()>; + fn redescribe_video(id: String, new: &str) -> err::Result<()>; }