Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ opendal-layer-await-tree = { path = "layers/await-tree", version = "0.55.0", opt
opendal-layer-capability-check = { path = "layers/capability-check", version = "0.55.0", optional = true, default-features = false }
opendal-layer-chaos = { path = "layers/chaos", version = "0.55.0", optional = true, default-features = false }
opendal-layer-concurrent-limit = { path = "layers/concurrent-limit", version = "0.55.0", optional = true, default-features = false }
opendal-layer-dtrace = { path = "layers/dtrace", version = "0.55.0", optional = true, default-features = false }
opendal-layer-fastmetrics = { path = "layers/fastmetrics", version = "0.55.0", optional = true, default-features = false }
opendal-layer-fastrace = { path = "layers/fastrace", version = "0.55.0", optional = true, default-features = false }
opendal-layer-hotpath = { path = "layers/hotpath", version = "0.55.0", optional = true, default-features = false }
Expand Down Expand Up @@ -288,6 +287,9 @@ opendal-service-webhdfs = { path = "services/webhdfs", version = "0.55.0", optio
opendal-service-yandex-disk = { path = "services/yandex-disk", version = "0.55.0", optional = true, default-features = false }
opendal-testkit = { path = "testkit", version = "0.55.0", optional = true }

[target.'cfg(target_os = "linux")'.dependencies]
opendal-layer-dtrace = { path = "layers/dtrace", version = "0.55.0", optional = true, default-features = false }

[target.'cfg(target_arch = "wasm32")'.dependencies]
opendal-service-opfs = { path = "services/opfs", version = "0.55.0", optional = true, default-features = false }

Expand Down
2 changes: 1 addition & 1 deletion core/core/src/docs/performance/http_optimization.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ In addition to the options mentioned above, `Xuanwo/reqwest-hickory-resolver` al

`reqwest` didn't set a default timeout for HTTP requests. This means that if a request hangs or takes too long to complete, it can block the entire process, leading to performance degradation or even application crashes.

It's recommended to set a connect timeout for HTTP requests to prevent this issue.
It's recommended to set a connect timeout for HTTP requests to prevent this issue.

```rust
let client = reqwest::ClientBuilder::new()
Expand Down
13 changes: 5 additions & 8 deletions core/core/src/docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ OpenDAL v0.54 implements [RFC-6213](https://opendal.apache.org/docs/rust/opendal
New APIs added:

- `read_options(path, ReadOptions)`
- `write_options(path, data, WriteOptions)`
- `write_options(path, data, WriteOptions)`
- `list_options(path, ListOptions)`
- `stat_options(path, StatOptions)`
- `delete_options(path, DeleteOptions)`
Expand All @@ -70,7 +70,7 @@ let options = ReadOptions::new()
.if_match("etag");
let data = op.read_options("path/to/file", options).await?;

// Write with options
// Write with options
let options = WriteOptions::new()
.content_type("text/plain")
.cache_control("max-age=3600");
Expand Down Expand Up @@ -118,7 +118,7 @@ New options-based presign APIs have been exposed:
```rust
let options = PresignOptions::new()
.expire(Duration::from_secs(3600));

let url = op.presign_read_options("path/to/file", options).await?;
```

Expand Down Expand Up @@ -171,7 +171,6 @@ For example:
- `Operation::ReaderRead` has been merged into `Operation::Read`
- `Operation::BlockingRead` has been merged into `Operation::Read`


# Upgrade to v0.52

## Public API
Expand Down Expand Up @@ -636,7 +635,7 @@ After [RFC: List Prefix](crate::docs::rfcs::rfc_3243_list_prefix) landed, we hav
Here are the behavior list:

| Case | Path | Result |
|------------------------|-----------------|--------------------------------------------|
| ---------------------- | --------------- | ------------------------------------------ |
| stat existing dir | `abc/` | Metadata with dir mode |
| stat existing file | `abc/def_file` | Metadata with file mode |
| stat dir without `/` | `abc/def_dir` | Error `NotFound` or metadata with dir mode |
Expand Down Expand Up @@ -773,8 +772,6 @@ OpenDAL v0.40 removed the origin `range_read` and `range_reader` interfaces, ple
+ let reader = op.reader_with(path).range(range_start..range_end).await?;
```



## Raw API

### RFC-3017 Remove Write Copy From
Expand Down Expand Up @@ -962,7 +959,7 @@ More details could be found at [RFC: Remove Object Concept][crate::docs::rfcs::r
To upgrade to OpenDAL v0.30, users need to make the following changes:

- regex replace `object\((.*)\).reader\(\)` to `reader($1)`
- replace the function on your case, it's recommended to do it one by one
- replace the function on your case, it's recommended to do it one by one
- rename `ObjectMetakey` => `Metakey`
- rename `ObjectMode` => `EntryMode`
- replace `ErrorKind::ObjectXxx` to `ErrorKind::Xxx`
Expand Down
38 changes: 26 additions & 12 deletions core/layers/async-backtrace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
// specific language governing permissions and limitations
// under the License.

use opendal_core::raw::oio;
//! Async backtrace layer implementation for Apache OpenDAL.

#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(missing_docs)]

use opendal_core::raw::*;
use opendal_core::*;

Expand All @@ -29,30 +33,39 @@ use opendal_core::*;
/// # Examples
///
/// ```no_run
/// use opendal_layer_async_backtrace::AsyncBacktraceLayer;
/// use opendal_core::services;
/// use opendal_core::Operator;
/// use opendal_core::Result;
///
/// # use opendal_core::services;
/// # use opendal_core::Operator;
/// # use opendal_core::Result;
/// # use opendal_layer_async_backtrace::AsyncBacktraceLayer;
/// #
/// # fn main() -> Result<()> {
/// let _ = Operator::new(services::Memory::default())?
/// .layer(AsyncBacktraceLayer::default())
/// .layer(AsyncBacktraceLayer::new())
/// .finish();
/// Ok(())
/// # Ok(())
/// # }
/// ```
#[derive(Clone, Default)]
pub struct AsyncBacktraceLayer;
#[non_exhaustive]
pub struct AsyncBacktraceLayer {}

impl AsyncBacktraceLayer {
/// Create a new [`AsyncBacktraceLayer`].
pub fn new() -> Self {
Self::default()
}
}

impl<A: Access> Layer<A> for AsyncBacktraceLayer {
type LayeredAccess = AsyncBacktraceAccessor<A>;

fn layer(&self, accessor: A) -> Self::LayeredAccess {
AsyncBacktraceAccessor { inner: accessor }
fn layer(&self, inner: A) -> Self::LayeredAccess {
AsyncBacktraceAccessor { inner }
}
}

#[derive(Debug, Clone)]
#[doc(hidden)]
#[derive(Debug)]
pub struct AsyncBacktraceAccessor<A: Access> {
inner: A,
}
Expand Down Expand Up @@ -121,6 +134,7 @@ impl<A: Access> LayeredAccess for AsyncBacktraceAccessor<A> {
}
}

#[doc(hidden)]
pub struct AsyncBacktraceWrapper<R> {
inner: R,
}
Expand Down
25 changes: 16 additions & 9 deletions core/layers/await-tree/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
// specific language governing permissions and limitations
// under the License.

//! Await tree layer implementation for Apache OpenDAL.

#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(missing_docs)]

use await_tree::InstrumentAwait;
use futures::Future;

use opendal_core::raw::*;
use opendal_core::*;

Expand All @@ -32,37 +36,39 @@ use opendal_core::*;
/// # Examples
///
/// ```no_run
/// # use opendal_layer_await_tree::AwaitTreeLayer;
/// # use opendal_core::services;
/// # use opendal_core::Operator;
/// # use opendal_core::Result;
///
/// # use opendal_layer_await_tree::AwaitTreeLayer;
/// #
/// # fn main() -> Result<()> {
/// let _ = Operator::new(services::Memory::default())?
/// .layer(AwaitTreeLayer::new())
/// .finish();
/// Ok(())
/// # Ok(())
/// # }
/// ```
#[derive(Clone, Default)]
#[non_exhaustive]
pub struct AwaitTreeLayer {}

impl AwaitTreeLayer {
/// Create a new `AwaitTreeLayer`.
/// Create a new [`AwaitTreeLayer`].
pub fn new() -> Self {
Self {}
Self::default()
}
}

impl<A: Access> Layer<A> for AwaitTreeLayer {
type LayeredAccess = AwaitTreeAccessor<A>;

fn layer(&self, accessor: A) -> Self::LayeredAccess {
AwaitTreeAccessor { inner: accessor }
fn layer(&self, inner: A) -> Self::LayeredAccess {
AwaitTreeAccessor { inner }
}
}

#[derive(Debug, Clone)]
#[doc(hidden)]
#[derive(Debug)]
pub struct AwaitTreeAccessor<A: Access> {
inner: A,
}
Expand Down Expand Up @@ -139,6 +145,7 @@ impl<A: Access> LayeredAccess for AwaitTreeAccessor<A> {
}
}

#[doc(hidden)]
pub struct AwaitTreeWrapper<R> {
inner: R,
}
Expand Down
52 changes: 31 additions & 21 deletions core/layers/capability-check/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@
// specific language governing permissions and limitations
// under the License.

//! Capability check layer implementation for Apache OpenDAL.

#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(missing_docs)]

use std::fmt::Debug;
use std::fmt::Formatter;
use std::sync::Arc;

use opendal_core::raw::*;
use opendal_core::{Error, ErrorKind, Result};
use opendal_core::*;

/// Add an extra capability check layer for every operation
///
Expand All @@ -38,24 +43,31 @@ use opendal_core::{Error, ErrorKind, Result};
/// 2. OpenDAL doesn't apply this checker by default. Users can enable this layer if they want to
/// enforce stricter requirements.
///
/// # examples
/// # Examples
///
/// ```no_run
/// # use opendal_layer_capability_check::CapabilityCheckLayer;
/// # use opendal_core::services;
/// # use opendal_core::Operator;
/// # use opendal_core::Result;
///
/// # use opendal_layer_capability_check::CapabilityCheckLayer;
/// #
/// # fn main() -> Result<()> {
/// use opendal_layer_capability_check::CapabilityCheckLayer;
/// let _ = Operator::new(services::Memory::default())?
/// .layer(CapabilityCheckLayer)
/// .layer(CapabilityCheckLayer::new())
/// .finish();
/// Ok(())
/// # Ok(())
/// # }
/// ```
#[derive(Default)]
pub struct CapabilityCheckLayer;
#[derive(Clone, Default)]
#[non_exhaustive]
pub struct CapabilityCheckLayer {}

impl CapabilityCheckLayer {
/// Create a new [`CapabilityCheckLayer`].
pub fn new() -> Self {
Self::default()
}
}

impl<A: Access> Layer<A> for CapabilityCheckLayer {
type LayeredAccess = CapabilityAccessor<A>;
Expand All @@ -67,11 +79,20 @@ impl<A: Access> Layer<A> for CapabilityCheckLayer {
}
}

#[doc(hidden)]
pub struct CapabilityAccessor<A: Access> {
info: Arc<AccessorInfo>,
inner: A,
}

impl<A: Access> Debug for CapabilityAccessor<A> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_struct("CapabilityCheckAccessor")
.field("inner", &self.inner)
.finish_non_exhaustive()
}
}

fn new_unsupported_error(info: &AccessorInfo, op: Operation, args: &str) -> Error {
let scheme = info.scheme();
let op = op.into_static();
Expand All @@ -83,14 +104,6 @@ fn new_unsupported_error(info: &AccessorInfo, op: Operation, args: &str) -> Erro
.with_operation(op)
}

impl<A: Access> Debug for CapabilityAccessor<A> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_struct("CapabilityCheckAccessor")
.field("inner", &self.inner)
.finish_non_exhaustive()
}
}

impl<A: Access> LayeredAccess for CapabilityAccessor<A> {
type Inner = A;
type Reader = A::Reader;
Expand Down Expand Up @@ -154,9 +167,6 @@ impl<A: Access> LayeredAccess for CapabilityAccessor<A> {
#[cfg(test)]
mod tests {
use super::*;
use opendal_core::Capability;
use opendal_core::ErrorKind;
use opendal_core::Operator;

#[derive(Debug)]
struct MockService {
Expand Down Expand Up @@ -188,7 +198,7 @@ mod tests {
fn new_test_operator(capability: Capability) -> Operator {
let srv = MockService { capability };

Operator::from_inner(Arc::new(srv)).layer(CapabilityCheckLayer)
Operator::from_inner(Arc::new(srv)).layer(CapabilityCheckLayer::new())
}

#[tokio::test]
Expand Down
Loading
Loading