chore: Arc the uri internal to and rarely used by Storage so that cloning it is cheaper
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
use std::{fmt::Debug, str::FromStr};
|
use std::{fmt::Debug, str::FromStr, sync::Arc};
|
||||||
|
|
||||||
use opendal::{IntoOperatorUri, Operator, OperatorUri};
|
use opendal::{IntoOperatorUri, Operator, OperatorUri};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Storage {
|
pub struct Storage {
|
||||||
uri: OperatorUri,
|
uri: Arc<OperatorUri>,
|
||||||
operator: Operator,
|
operator: Operator,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,6 +14,8 @@ impl FromStr for Storage {
|
|||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
let uri = s.into_operator_uri()?;
|
let uri = s.into_operator_uri()?;
|
||||||
let operator = Operator::from_uri(&uri)?;
|
let operator = Operator::from_uri(&uri)?;
|
||||||
|
|
||||||
|
let uri = uri.into();
|
||||||
|
|
||||||
Ok(Self { uri, operator })
|
Ok(Self { uri, operator })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user