Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(integration/object_store): Avoid calling API inside debug #4846

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions integrations/object_store/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
// specific language governing permissions and limitations
// under the License.

use std::fmt::{Debug, Display, Formatter};
use std::future::IntoFuture;
use std::ops::Range;

use crate::utils::*;
use async_trait::async_trait;
use bytes::Bytes;
Expand All @@ -38,8 +34,12 @@ use object_store::PutMultipartOpts;
use object_store::PutOptions;
use object_store::PutPayload;
use object_store::PutResult;
use opendal::Operator;
use opendal::{Buffer, Metakey};
use opendal::{Operator, OperatorInfo};
use std::fmt::{Debug, Display, Formatter};
use std::future::IntoFuture;
use std::ops::Range;
use std::sync::Arc;

/// OpendalStore implements ObjectStore trait by using opendal.
///
Expand Down Expand Up @@ -93,24 +93,27 @@ use opendal::{Buffer, Metakey};
/// }
/// ```
pub struct OpendalStore {
info: Arc<OperatorInfo>,
inner: Operator,
}

impl OpendalStore {
/// Create OpendalStore by given Operator.
pub fn new(op: Operator) -> Self {
Self { inner: op }
Self {
info: op.info().into(),
inner: op,
}
}
}

impl Debug for OpendalStore {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let info = self.inner.info();
f.debug_struct("OpendalStore")
.field("scheme", &info.scheme())
.field("name", &info.name())
.field("root", &info.root())
.field("capability", &info.full_capability())
.field("scheme", &self.info.scheme())
.field("name", &self.info.name())
.field("root", &self.info.root())
.field("capability", &self.info.full_capability())
.finish()
}
}
Expand Down
Loading