v0.26.0
版本发布时间: 2023-02-04 18:06:03
apache/opendal最新发布版本:v0.49.2(2024-08-29 15:40:35)
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 https://github.com/datafuselabs/opendal/pull/1257
- feat: Add benchmarks for blocking_seek operations by @Xuanwo in https://github.com/datafuselabs/opendal/pull/1258
- feat: add dev container by @PsiACE in https://github.com/datafuselabs/opendal/pull/1261
- chore: refine devcontainer by @PsiACE in https://github.com/datafuselabs/opendal/pull/1262
- feat: Zero Cost OpenDAL by @Xuanwo in https://github.com/datafuselabs/opendal/pull/1260
- refactor: some code in GitHub Actions by @yihong0618 in https://github.com/datafuselabs/opendal/pull/1269
- refactor: Don't expose services mod directly by @Xuanwo in https://github.com/datafuselabs/opendal/pull/1271
- refactor: Polish Builder API by @Xuanwo in https://github.com/datafuselabs/opendal/pull/1272
- feat: Allow dynamic dispatch layer by @Xuanwo in https://github.com/datafuselabs/opendal/pull/1273
- Bump to version 0.26.0 by @Xuanwo in https://github.com/datafuselabs/opendal/pull/1274
New Contributors
- @Kilerd made their first contribution in https://github.com/datafuselabs/opendal/pull/1257
Full Changelog: https://github.com/datafuselabs/opendal/compare/v0.25.2...v0.26.0