Skip to content

Commit

Permalink
feat(services): add cacache backend (#2548)
Browse files Browse the repository at this point in the history
* feat(services): add cacache backend

Signed-off-by: Chojan Shang <[email protected]>

* chore(ci&env): add cacache example

Signed-off-by: Chojan Shang <[email protected]>

* docs: add cacache

Signed-off-by: Chojan Shang <[email protected]>

* fix(cacache): map err kind

Signed-off-by: Chojan Shang <[email protected]>

* fix(cacache): make clippy happy

Signed-off-by: Chojan Shang <[email protected]>

---------

Signed-off-by: Chojan Shang <[email protected]>
  • Loading branch information
PsiACE authored Jun 27, 2023
1 parent 8df334f commit ef4e1ca
Show file tree
Hide file tree
Showing 14 changed files with 407 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,6 @@ OPENDAL_WASABI_SECRET_ACCESS_KEY=<sk>
OPENDAL_REDB_TEST=false
OPENDAL_REDB_DATADIR=/tmp/redb
OPENDAL_REDB_TABLE=redb-table
# cacache
OPENDAL_CACACHE_TEST=false
OPENDAL_CACACHE_DATADIR=/tmp/opendal/cacache/
54 changes: 54 additions & 0 deletions .github/workflows/service_test_cacache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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: Service Test Cacache

on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- "core/src/**"
- "core/tests/**"
- "!core/src/docs/**"
- "!core/src/services/**"
- "core/src/services/cacache/**"
- ".github/workflows/service_test_cacache.yml"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

jobs:
cacache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: ./.github/actions/setup
- name: Test cacache
shell: bash
working-directory: core
run: cargo test cacache --features services-cacache -j=1
env:
RUST_BACKTRACE: full
RUST_LOG: debug
OPENDAL_CACACHE_TEST: on
OPENDAL_CACACHE_DATADIR: /tmp/opendal/cacache/
119 changes: 117 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Major components of the project include:
<details>
<summary>Key-Value Storage Service (like rocksdb, sled)</summary>

- cacache: [cacache](https://crates.io/crates/cacache) backend
- dashmap: [dashmap](https://github.com/xacrimon/dashmap) backend
- memory: In memory backend
- redis: [Redis](https://redis.io/) services
Expand Down
2 changes: 2 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ services-azdfs = [
"reqsign?/services-azblob",
"reqsign?/reqwest_request",
]
services-cacache = ["dep:cacache"]
services-cos = [
"dep:reqsign",
"reqsign?/services-tencent",
Expand Down Expand Up @@ -180,6 +181,7 @@ backon = "0.4.0"
base64 = "0.21"
bb8 = { version = "0.8", optional = true }
bytes = "1.2"
cacache = { version = "11.6", default-features = false, features = ["tokio-runtime", "mmap"], optional = true }
chrono = "0.4.24"
dashmap = { version = "5.4", optional = true }
dirs = { version = "5.0.1", optional = true }
Expand Down
1 change: 1 addition & 0 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

- [azblob](https://docs.rs/opendal/latest/opendal/services/struct.Azblob.html): [Azure Storage Blob](https://azure.microsoft.com/en-us/services/storage/blobs/) services.
- [azdfs](https://docs.rs/opendal/latest/opendal/services/struct.Azdfs.html): [Azure Data Lake Storage Gen2](https://azure.microsoft.com/en-us/products/storage/data-lake-storage/) services. (As known as [abfs](https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-abfs-driver))
- [cacache](https://docs.rs/opendal/latest/opendal/services/struct.Cacache.html): [cacache](https://crates.io/crates/cacache) backend support.
- [dashmap](https://docs.rs/opendal/latest/opendal/services/struct.Dashmap.html): [dashmap](https://github.com/xacrimon/dashmap) backend support.
- [fs](https://docs.rs/opendal/latest/opendal/services/struct.Fs.html): POSIX alike file system.
- [ftp](https://docs.rs/opendal/latest/opendal/services/struct.Ftp.html): FTP and FTPS support.
Expand Down
Loading

0 comments on commit ef4e1ca

Please sign in to comment.