v0.26.0
Upgrade to v0.26
In v0.26 we have replaced all internal dynamic dispatch usage with static dispatch. With this change, we can ensure that all operations performed inside OpenDAL are zero cost.
Due to this change, we have to refactor the logic of Operator
's init logic. In v0.26, we added opendal::Builder
trait and opendal::OperatorBuilder
. For the first glance, the only change to existing code will be like:
- let op = Operator::new(builder.build()?);
+ let op = Operator::new(builder.build()?).finish();
By adding a finish()
call, we will erase all generic types so that Operator
can still be easily to used everywhere as before.
Accessor
In v0.26, Accessor
has been changed into trait with associated types.
All services need to decalare the types returned as Reader
or BlockingReader
:
pub trait Accessor: Send + Sync + Debug + Unpin + 'static {
type Reader: output::Read;
type BlockingReader: output::BlockingRead;
}
If your service doesn't support read
or blocking_read
, we can use ()
to represent an dummy reader:
impl Accessor for MyDummyAccessor {
type Reader = ();
type BlockingReader = ();
}
Layer
As described before, OpenDAL prefer to use static dispatch. Layers are required to implement the new Layer
and LayeredAccessor
trait:
pub trait Layer<A: Accessor> {
type LayeredAccessor: Accessor;
fn layer(&self, inner: A) -> Self::LayeredAccessor;
}
#[async_trait]
pub trait LayeredAccessor: Send + Sync + Debug + Unpin + 'static {
type Inner: Accessor;
type Reader: output::Read;
type BlockingReader: output::BlockingRead;
}
LayeredAccessor
is a wrapper of Accessor
with the typed Innder
. All methods that not implemented will be forward to inner instead.
Builder
Since v0.26, we implement opendal::Builder
for all services, and services' mod will not be exported.
- use opendal::services::s3::Builder;
+ use opendal::services::S3;
Conclusion
Sorry again for the big changes in this release. It's a big step for OpenDAL to work in more critical systems.
What's Changed
- refactor: remove the duplicated dependency in dev-dependencies by @Kilerd in #1257
- feat: Add benchmarks for blocking_seek operations by @Xuanwo in #1258
- feat: add dev container by @PsiACE in #1261
- chore: refine devcontainer by @PsiACE in #1262
- feat: Zero Cost OpenDAL by @Xuanwo in #1260
- refactor: some code in GitHub Actions by @yihong0618 in #1269
- refactor: Don't expose services mod directly by @Xuanwo in #1271
- refactor: Polish Builder API by @Xuanwo in #1272
- feat: Allow dynamic dispatch layer by @Xuanwo in #1273
- Bump to version 0.26.0 by @Xuanwo in #1274
New Contributors
Full Changelog: v0.25.2...v0.26.0