-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
690 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
name: Integration Compat CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "integrations/compat/**" | ||
- "core/**" | ||
- ".github/workflows/ci_integration_compat.yml" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check_clippy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Rust toolchain | ||
uses: ./.github/actions/setup | ||
|
||
- name: Cargo clippy | ||
working-directory: integrations/compat | ||
run: cargo clippy --all-targets --all-features -- -D warnings | ||
|
||
- name: Cargo test | ||
working-directory: integrations/compat | ||
run: cargo test --all-features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
[package] | ||
description = "Apache OpenDAL Compat" | ||
name = "opendal_compat" | ||
|
||
authors = ["Apache OpenDAL <[email protected]>"] | ||
edition = "2021" | ||
homepage = "https://opendal.apache.org/" | ||
license = "Apache-2.0" | ||
repository = "https://github.com/apache/opendal" | ||
rust-version = "1.75" | ||
version = "1.0.0" | ||
|
||
[features] | ||
v0_50_to_v0_49 = ["dep:opendal_v0_49", "dep:opendal_v0_50"] | ||
|
||
[dependencies] | ||
async-trait = "0.1" | ||
opendal_v0_49 = { package = "opendal", version = "0.49", optional = true } | ||
opendal_v0_50 = { package = "opendal", version = "0.50", optional = true, path = "../../core" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Apache OpenDAL™ Compat integration | ||
|
||
[![Build Status]][actions] [![Latest Version]][crates.io] [![Crate Downloads]][crates.io] [![chat]][discord] | ||
|
||
[build status]: https://img.shields.io/github/actions/workflow/status/apache/opendal/ci_integration_compat.yml?branch=main | ||
[actions]: https://github.com/apache/opendal/actions?query=branch%3Amain | ||
[latest version]: https://img.shields.io/crates/v/opendal_compat.svg | ||
[crates.io]: https://crates.io/crates/opendal_compat | ||
[crate downloads]: https://img.shields.io/crates/d/opendal_compat.svg | ||
[chat]: https://img.shields.io/discord/1081052318650339399 | ||
[discord]: https://opendal.apache.org/discord | ||
|
||
`opendal-compat` provides compatibility functions for opendal. | ||
|
||
This crate can make it easier to resolve the compatibility issues between different versions of opendal. | ||
|
||
## Useful Links | ||
|
||
- Documentation: [release](https://docs.rs/opendal_compat/) | [dev](https://opendal.apache.org/docs/opendal_compat/opendal_compat/) | ||
|
||
## Examples | ||
|
||
Add the following dependencies to your `Cargo.toml` with correct version: | ||
|
||
```toml | ||
[dependencies] | ||
opendal_compat = { version = "1", features = ["v0_50_to_v0_49"] } | ||
opendal = { version = "0.50.0" } | ||
opendal_v0_49 = { package="opendal", version = "0.49" } | ||
``` | ||
|
||
Convert `opendal::Operator` to old opendal `Operator`: | ||
|
||
```rust | ||
use opendal_v0_50::Operator; | ||
use opendal_v0_50::services::MemoryConfig; | ||
use opendal_v0_50::Result; | ||
|
||
fn i_need_opendal_v0_49_op(op: opendal_v0_49::Operator) { | ||
// do something with old opendal; | ||
} | ||
|
||
fn main() -> Result<()> { | ||
let v0_50_op = Operator::from_config(MemoryConfig::default())?.finish(); | ||
let v0_49_op = opendal_compat::v0_50_to_v0_49(v0_50_op); | ||
i_need_opendal_v0_49_op(v0_49_op); | ||
Ok(()) | ||
} | ||
``` | ||
|
||
## Branding | ||
|
||
The first and most prominent mentions must use the full form: **Apache OpenDAL™** of the name for any individual usage (webpage, handout, slides, etc.) Depending on the context and writing style, you should use the full form of the name sufficiently often to ensure that readers clearly understand the association of both the OpenDAL project and the OpenDAL software product to the ASF as the parent organization. | ||
|
||
For more details, see the [Apache Product Name Usage Guide](https://www.apache.org/foundation/marks/guide). | ||
|
||
## License and Trademarks | ||
|
||
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Apache OpenDAL, OpenDAL, and Apache are either registered trademarks or trademarks of the Apache Software Foundation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
//! `opendal_compat` provides compatibility functions for opendal. | ||
//! | ||
//! OpenDAL is widely used across the entire big data ecosystem. Various projects may utilize | ||
//! different versions of OpenDAL. This crate provides compatibility functions to assist users | ||
//! in upgrading OpenDAL without altering their existing code, especially for projects that | ||
//! accept OpenDAL Operators. | ||
//! | ||
//! Please note that `opendal_compat` only ensures that the code compiles and runs. However, | ||
//! it does not guarantee that the code will function as expected. The underlying behavior of | ||
//! OpenDAL may vary between versions, and the compatibility functions might not address all | ||
//! changes. It is advisable to test the code thoroughly after upgrading OpenDAL. | ||
//! | ||
//! This project is organized by version. Each version has its own module hidden within a feature, | ||
//! and each module contains only one function that converts from the latest version to the | ||
//! previous version. | ||
//! | ||
//! Currently, `opendal_compat` supports the following versions: | ||
//! | ||
//! - [`v0_50_to_v0_49()`] | ||
//! | ||
//! Please refer to the specific function for more information. | ||
#[cfg(feature = "v0_50_to_v0_49")] | ||
mod v0_50_to_v0_49; | ||
#[cfg(feature = "v0_50_to_v0_49")] | ||
pub use v0_50_to_v0_49::v0_50_to_v0_49; |
Oops, something went wrong.