Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
Signed-off-by: tison <[email protected]>
  • Loading branch information
tisonkun committed Aug 23, 2024
1 parent a38d0da commit 765343a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion core/src/services/mysql/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub struct Adapter {
impl Adapter {
async fn get_client(&self) -> Result<&MySqlPool> {
self.pool
.get_or_try_init(async {
.get_or_try_init(|| async {
let pool = MySqlPool::connect_with(self.config.clone())
.await
.map_err(parse_mysql_error)?;
Expand Down
2 changes: 1 addition & 1 deletion core/src/services/postgresql/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ pub struct Adapter {
impl Adapter {
async fn get_client(&self) -> Result<&PgPool> {
self.pool
.get_or_try_init(async {
.get_or_try_init(|| async {
let pool = PgPool::connect_with(self.config.clone())
.await
.map_err(parse_postgres_error)?;
Expand Down
2 changes: 1 addition & 1 deletion core/src/services/sqlite/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ pub struct Adapter {
impl Adapter {
async fn get_client(&self) -> Result<&SqlitePool> {
self.pool
.get_or_try_init(async {
.get_or_try_init(|| async {
let pool = SqlitePool::connect_with(self.config.clone())
.await
.map_err(parse_sqlite_error)?;
Expand Down
20 changes: 10 additions & 10 deletions integrations/cloudfilter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
//! It provides a way to access various cloud storage on Windows.
//!
//! Note that `cloudfilter_opendal` is a read-only service, and it is not recommended to use it in production.
//!
//!
//! # Example
//!
//!
//! ```no_run
//! use anyhow::Result;
//! use cloud_filter::root::PopulationType;
Expand All @@ -33,7 +33,7 @@
//! use opendal::Operator;
//! use tokio::runtime::Handle;
//! use tokio::signal;
//!
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! // Create any service desired
Expand All @@ -45,14 +45,14 @@
//! ("region".to_string(), "my_region".to_string()),
//! ])?
//! .finish();
//!
//!
//! let client_path = std::env::var("CLIENT_PATH").expect("$CLIENT_PATH is set");
//!
//!
//! // Create a sync root id
//! let sync_root_id = SyncRootIdBuilder::new("cloudfilter_opendal")
//! .user_security_id(SecurityId::current_user()?)
//! .build();
//!
//!
//! // Register the sync root if not exists
//! if !sync_root_id.is_registered()? {
//! sync_root_id.register(
Expand All @@ -65,20 +65,20 @@
//! .with_path(&client_path)?,
//! )?;
//! }
//!
//!
//! let handle = Handle::current();
//! let connection = Session::new().connect_async(
//! &client_path,
//! cloudfilter_opendal::CloudFilter::new(op, client_path.clone().into()),
//! move |f| handle.block_on(f),
//! )?;
//!
//!
//! signal::ctrl_c().await?;
//!
//!
//! // Drop the connection before unregister the sync root
//! drop(connection);
//! sync_root_id.unregister()?;
//!
//!
//! Ok(())
//! }
//! ``````
Expand Down

0 comments on commit 765343a

Please sign in to comment.