You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2024/10/24 13:47:42 UTC
(opendal) branch main updated: fix(integration/compat): Fix opendal 0.50 OpList has new field (#5238)
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new f6c5fc3729 fix(integration/compat): Fix opendal 0.50 OpList has new field (#5238)
f6c5fc3729 is described below
commit f6c5fc372971bd802823a78cf63ef97d49ebce89
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Thu Oct 24 21:47:36 2024 +0800
fix(integration/compat): Fix opendal 0.50 OpList has new field (#5238)
Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
integrations/compat/src/v0_50_to_v0_49.rs | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/integrations/compat/src/v0_50_to_v0_49.rs b/integrations/compat/src/v0_50_to_v0_49.rs
index fea3744b0d..7810d69905 100644
--- a/integrations/compat/src/v0_50_to_v0_49.rs
+++ b/integrations/compat/src/v0_50_to_v0_49.rs
@@ -345,6 +345,7 @@ impl<I: opendal_v0_50::raw::oio::BlockingList> opendal_v0_49::raw::oio::Blocking
/// `transmute` also perform compile time checks to detect any type size mismatch like `OpWrite`
/// in which we added a new field since v0.50.
mod convert {
+ use opendal_v0_50::Metakey;
use std::mem::transmute;
pub fn error_into(e: opendal_v0_50::Error) -> opendal_v0_49::Error {
@@ -474,8 +475,28 @@ mod convert {
unsafe { transmute(e) }
}
+ /// OpenDAL v0.50's OpList has a new field `version`.
pub fn raw_op_list_from(e: opendal_v0_49::raw::OpList) -> opendal_v0_50::raw::OpList {
- unsafe { transmute(e) }
+ let mut op = opendal_v0_50::raw::OpList::new();
+
+ if let Some(v) = e.limit() {
+ op = op.with_limit(v);
+ }
+
+ if let Some(v) = e.start_after() {
+ op = op.with_start_after(v);
+ }
+
+ if e.recursive() {
+ op = op.with_recursive(true);
+ }
+
+ // There is no way for us to convert `metakey` without depending on `flagset`,
+ // let's just hardcode them.
+ op = op.with_metakey(Metakey::Mode | Metakey::LastModified);
+ op = op.with_concurrent(e.concurrent());
+
+ op
}
pub fn raw_rp_list_into(e: opendal_v0_50::raw::RpList) -> opendal_v0_49::raw::RpList {