Skip to content

Commit

Permalink
feat: Set MSRV of opendal to 1.60 (#1012)
Browse files Browse the repository at this point in the history
* feat: Set MSRV of opendal to 1.60

Signed-off-by: Xuanwo <[email protected]>

* Add component

Signed-off-by: Xuanwo <[email protected]>

* Fix build

Signed-off-by: Xuanwo <[email protected]>

* Use 1.60 for test

Signed-off-by: Xuanwo <[email protected]>

* Don't lint deps

Signed-off-by: Xuanwo <[email protected]>

* Make opendal works on 1.60

Signed-off-by: Xuanwo <[email protected]>

Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo authored Nov 27, 2022
1 parent ac25378 commit 4c6d768
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 10 deletions.
40 changes: 34 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
- name: Checkout python env
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: "3.8"
- name: Checkout java env
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '11'
java-version: "11"
- name: Setup-hdfs env
uses: beyondstorage/setup-hdfs@master
with:
Expand All @@ -39,6 +39,34 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

msrv_check:
runs-on: ubuntu-latest
env:
# OpenDAL's MSRV is 1.60.
OPENDAL_MSRV: "1.60"
steps:
- uses: actions/checkout@v3
- name: Checkout python env
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Checkout java env
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: "11"
- name: Setup-hdfs env
uses: beyondstorage/setup-hdfs@master
with:
hdfs-version: "3.3.2"
- name: Setup msrv of rust
run: |
rustup toolchain install ${OPENDAL_MSRV}
rustup component add clippy --toolchain ${OPENDAL_MSRV}
- name: Check
run: cargo +${OPENDAL_MSRV} clippy --no-deps --all-targets --all-features -- -D warnings

build:
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -61,12 +89,12 @@ jobs:
- name: Checkout python env
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: "3.8"
- name: Checkout java env
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '11'
java-version: "11"
- name: Setup-hdfs env
uses: beyondstorage/setup-hdfs@master
with:
Expand All @@ -86,12 +114,12 @@ jobs:
- name: Checkout python env
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: "3.8"
- name: Checkout java env
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '11'
java-version: "11"
- name: Setup-hdfs env
uses: beyondstorage/setup-hdfs@master
with:
Expand Down
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ all-features = true
default = ["rustls"]

# Enable compress support so that users can decompress while reading.
compress = ["async-compression"]
compress = ["async-compression", "zstd-sys"]
# Enable trust-dns for better dns cache.
trust-dns = ["reqwest/trust-dns"]

Expand Down Expand Up @@ -47,7 +47,7 @@ services-moka = ["moka"]
# Enable services redis support
services-redis = ["redis"]
# Enable services rocksdb support
services-rocksdb = ["rocksdb"]
services-rocksdb = ["rocksdb", "zstd-sys"]

[lib]
bench = false
Expand Down Expand Up @@ -126,6 +126,9 @@ redis = { version = "0.22", features = [
"tokio-comp",
"connection-manager",
], optional = true }
# zstd-sys 2.0.3 can't work on 1.60 for `ffi::c_uint` needs rust 1.64.
# Enable bindgen to make sure they works.
zstd-sys = { version = "2", optional = true, features = ["bindgen"] }
# Make sure we are using the latest pathc of reqsign.
# Should be removed after reqsign bumped to 0.7
reqsign = "0.6.6"
Expand Down
9 changes: 7 additions & 2 deletions src/object/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,12 @@ impl Object {
///
/// Called can decide to access or clone the content of object metadata.
/// But they can't pass the guard outside or across the await boundary.
async fn metadata_ref(&self) -> Result<MutexGuard<ObjectMetadata>> {
///
/// # Notes
///
/// We return `MutexGuard<'_, ObjectMetadata>` here to make rustc 1.60 happy.
/// After MSRV bumped to higher version, we can elide this.
async fn metadata_ref(&self) -> Result<MutexGuard<'_, ObjectMetadata>> {
// Make sure the mutex guard has been dropped.
{
let guard = self.meta.lock().expect("lock must succeed");
Expand All @@ -1208,7 +1213,7 @@ impl Object {
Ok(guard)
}

fn blocking_metadata_ref(&self) -> Result<MutexGuard<ObjectMetadata>> {
fn blocking_metadata_ref(&self) -> Result<MutexGuard<'_, ObjectMetadata>> {
// Make sure the mutex guard has been dropped.
{
let guard = self.meta.lock().expect("lock must succeed");
Expand Down

1 comment on commit 4c6d768

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for opendal ready!

✅ Preview
https://opendal-gokkob3k6-databend.vercel.app

Built with commit 4c6d768.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.