Skip to content

Commit

Permalink
feat: Add FoundationDB Support for OpenDAL (#2751)
Browse files Browse the repository at this point in the history
feat: Add basic write read support for foundationdb
  • Loading branch information
ArmandoZ authored Aug 4, 2023
1 parent 718d65f commit 77b8fd3
Show file tree
Hide file tree
Showing 12 changed files with 425 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ OPENDAL_WASABI_BUCKET=<bucket>
OPENDAL_WASABI_ENDPOINT=<endpoint>
OPENDAL_WASABI_ACCESS_KEY_ID=<ak>
OPENDAL_WASABI_SECRET_ACCESS_KEY=<sk>
# foundationdb
OPENDAL_FOUNDATIONDB_TEST=false
OPENDAL_FOUNDATIONDB_ROOT=/path/to/dir
OPENDAL_FOUNDATIONDB_CONFIG_PATH=/tmp/opendal/foundationdb.conf
# redb
OPENDAL_REDB_TEST=false
OPENDAL_REDB_DATADIR=/tmp/redb
Expand Down
27 changes: 27 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ description: 'Prepare Rust Build Environment'
inputs:
need-rocksdb:
description: "This setup needs rocksdb or not"
need-foundationdb:
description: "This setup needs foundationdb or not"
need-nextest:
description: "This setup needs nextest or not"
need-protoc:
Expand Down Expand Up @@ -96,3 +98,28 @@ runs:
cd ..
rm -rf /tmp/rocksdb-8.1.1
- name: Cache foundationdb
id: cache-foundationdb
uses: actions/cache@v3
if: runner.os == 'Linux' && inputs.need-foundationdb == 'true'
with:
path: /etc/foundationdb
key: r0-foundationdb-7.1.17

- name: Build foundationdb if not cached
if: steps.cache-foundationdb.outputs.cache-hit != 'true' && runner.os == 'Linux' && inputs.need-foundationdb == 'true'
shell: bash
run: |
set -e
cd /tmp
curl https://github.com/apple/foundationdb/releases/download/7.1.17/foundationdb-clients_7.1.17-1_amd64.deb -L -o foundationdb-clients_7.1.17-1_amd64.deb
curl https://github.com/apple/foundationdb/releases/download/7.1.17/foundationdb-server_7.1.17-1_amd64.deb -L -o foundationdb-server_7.1.17-1_amd64.deb
sudo dpkg -i foundationdb-clients_7.1.17-1_amd64.deb foundationdb-server_7.1.17-1_amd64.deb
rm foundationdb-clients_7.1.17-1_amd64.deb
rm foundationdb-server_7.1.17-1_amd64.deb
60 changes: 60 additions & 0 deletions .github/workflows/service_test_foundationdb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 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 Foundationdb

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

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

jobs:
foundationdb:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
need-foundationdb: true

- name: Test
shell: bash
working-directory: core
run: |
sudo service foundationdb start
cargo test foundationdb --features services-foundationdb -j=1
env:
RUST_BACKTRACE: full
RUST_LOG: debug
OPENDAL_FOUNDATIONDB_TEST: off
OPENDAL_FOUNDATIONDB_ROOT: /tmp/opendal
OPENDAL_FOUNDATIONDB_CONFIG_PATH: /etc/foundationdb/foundationdb.conf
82 changes: 81 additions & 1 deletion Cargo.lock

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

4 changes: 4 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ services-cos = [
services-dashmap = ["dep:dashmap"]
services-dropbox = []
services-etcd = ["dep:etcd-client"]
services-foundationdb = ["dep:foundationdb"]
services-fs = ["tokio/fs"]
services-ftp = ["dep:suppaftp", "dep:lazy-regex", "dep:bb8", "dep:async-tls"]
services-gcs = [
Expand Down Expand Up @@ -204,6 +205,9 @@ dashmap = { version = "5.4", optional = true }
dirs = { version = "5.0.1", optional = true }
etcd-client = { version = "0.11", optional = true, features = ["tls"] }
flagset = "0.4"
foundationdb = { version = "0.8.0", features = [
"embedded-fdb-include",
], optional = true }
futures = { version = "0.3", default-features = false, features = ["std"] }
governor = { version = "0.5", optional = true, features = ["std"] }
hdrs = { version = "0.3.0", optional = true, features = ["async_file"] }
Expand Down
Loading

0 comments on commit 77b8fd3

Please sign in to comment.