devirtualize service Data traits

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-05-27 03:17:20 +00:00
parent a6edaad6fc
commit 7ad7badd60
64 changed files with 1190 additions and 1176 deletions

View file

@ -44,17 +44,17 @@ pub struct UrlPreviewData {
pub struct Service {
server: Arc<Server>,
pub(super) db: Arc<dyn Data>,
pub db: Data,
pub url_preview_mutex: RwLock<HashMap<String, Arc<Mutex<()>>>>,
}
impl Service {
pub fn build(server: &Arc<Server>, db: &Arc<KeyValueDatabase>) -> Self {
Self {
pub fn build(server: &Arc<Server>, db: &Arc<KeyValueDatabase>) -> Result<Self> {
Ok(Self {
server: server.clone(),
db: db.clone(),
db: Data::new(db),
url_preview_mutex: RwLock::new(HashMap::new()),
}
})
}
/// Uploads a file.