From 7e8e688e2e58f9c944b941e768ab7b034a348a1f Mon Sep 17 00:00:00 2001 From: Vika Date: Thu, 1 Aug 2024 19:48:37 +0300 Subject: treewide: create a common method for state initialization Now the database objects can be uniformly created from a URI. They can also optionally do sanity checks and one-time initialization. --- src/media/storage/mod.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/media/storage/mod.rs') diff --git a/src/media/storage/mod.rs b/src/media/storage/mod.rs index 020999c..38410e6 100644 --- a/src/media/storage/mod.rs +++ b/src/media/storage/mod.rs @@ -86,6 +86,8 @@ pub type Result = std::result::Result; #[async_trait] pub trait MediaStore: 'static + Send + Sync + Clone { + // Initialize self from a URL, possibly performing asynchronous initialization. + async fn new(url: &'_ url::Url) -> Result; async fn write_streaming( &self, domain: &str, -- cgit 1.4.1