-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
325: remove posgres wire over ws, and refactor r=MarinPostma a=MarinPostma remove posgres wire porotocol over websocket and refactor to simlify architecture Co-authored-by: ad hoc <[email protected]>
- Loading branch information
Showing
19 changed files
with
143 additions
and
1,034 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use std::sync::Arc; | ||
|
||
use futures::Future; | ||
|
||
use super::Database; | ||
use crate::error::Error; | ||
|
||
#[async_trait::async_trait] | ||
pub trait DbFactory: Send + Sync { | ||
async fn create(&self) -> Result<Arc<dyn Database>, Error>; | ||
} | ||
|
||
#[async_trait::async_trait] | ||
impl<F, DB, Fut> DbFactory for F | ||
where | ||
F: Fn() -> Fut + Send + Sync + 'static, | ||
Fut: Future<Output = Result<DB, Error>> + Send, | ||
DB: Database + Sync + Send + 'static, | ||
{ | ||
async fn create(&self) -> Result<Arc<dyn Database>, Error> { | ||
let db = (self)().await?; | ||
Ok(Arc::new(db)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.