Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'Build'
description: 'Build the project'

runs:
using: "composite"
steps:
- uses: Swatinem/rust-cache@v1

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
42 changes: 42 additions & 0 deletions .github/actions/check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Check'
description: 'Check will do all essential checks'
inputs:
github_token:
description: "Github Token"
required: true
runs:
using: "composite"
steps:
- uses: Swatinem/rust-cache@v1
with:
sharedKey: base-v1

- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Check License Header
uses: apache/skywalking-eyes@main
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
with:
log: info

- name: Install cargo-audit
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-audit

- name: Audit dependencies
uses: actions-rs/cargo@v1
with:
command: audit

- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --tests -- -D warnings
17 changes: 17 additions & 0 deletions .github/actions/test_unit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Test Unit'
description: 'Running unit tests'

runs:
using: "composite"
steps:
- uses: Swatinem/rust-cache@v1

- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --no-fail-fast
env:
RUST_TEST_THREADS: '2'
RUST_LOG: ERROR
RUST_BACKTRACE: full
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on: [push, pull_request]

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

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/check
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

build:
runs-on: ${{ matrix.os }}
needs: check
strategy:
matrix:
os:
- ubuntu-latest
- macos-11
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/build

test_unit:
runs-on: ${{ matrix.os }}
needs: check
strategy:
matrix:
os:
- ubuntu-latest
- macos-11
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/test_unit
21 changes: 21 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
header:
license:
spdx-id: Apache-2.0
copyright-owner: Datafuse Labs
paths-ignore:
# Ignore hidden files
- ".*"
# Ignore LICENSE and Makefile
- "LICENSE"
- "Makefile"
# Ignore docs and generated files
- "**/*.md"
- "**/*.json"
- "**/*.sql"
- "**/*.proto"
- "**/*.yml"
- "**/*.yaml"
- "**/*.toml"
- "**/*.lock"

comment: on-failure
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "stable"
components = [ "rustfmt", "clippy" ]
6 changes: 4 additions & 2 deletions src/readers/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ pub struct CallbackReader<F: FnMut(usize)> {
}

impl<F> CallbackReader<F>
where F: FnMut(usize)
where
F: FnMut(usize),
{
/// # TODO
///
Expand All @@ -38,7 +39,8 @@ where F: FnMut(usize)
}

impl<F> futures::AsyncRead for CallbackReader<F>
where F: FnMut(usize)
where
F: FnMut(usize),
{
fn poll_read(
mut self: Pin<&mut Self>,
Expand Down
5 changes: 3 additions & 2 deletions src/readers/seekable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub struct SeekableReader {

enum SeekableReaderState {
Idle,
Starting(Pin<Box<dyn Future<Output=Result<Reader>> + Send>>),
Starting(Pin<Box<dyn Future<Output = Result<Reader>> + Send>>),
Reading(Reader),
}

Expand Down Expand Up @@ -98,7 +98,8 @@ impl AsyncRead for SeekableReader {
self.state = SeekableReaderState::Starting(f.boxed());
}
SeekableReaderState::Starting(ref mut fut) => {
let r = ready!(fut.as_mut().poll(cx)).map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
let r = ready!(fut.as_mut().poll(cx))
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;

self.state = SeekableReaderState::Reading(r);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/it/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

use std::sync::Arc;

use futures::lock::Mutex;
use opendal::ops::OpDelete;
use opendal::services::fs;
use opendal::Accessor;
use opendal::Layer;
use opendal::Operator;
use futures::lock::Mutex;

struct Test {
#[allow(dead_code)]
Expand Down
4 changes: 2 additions & 2 deletions tests/it/services/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

use std::str;

use opendal::services::fs;
use opendal::Operator;
use futures::io::AsyncReadExt;
use futures::io::Cursor;
use opendal::services::fs;
use opendal::Operator;

#[tokio::test]
async fn normal() {
Expand Down
2 changes: 1 addition & 1 deletion tests/it/services/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
// 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.
use futures::io::AsyncReadExt;
use opendal::credential::Credential;
use opendal::services::s3;
use opendal::Operator;
use futures::io::AsyncReadExt;

#[tokio::test]
async fn builder() {
Expand Down
10 changes: 5 additions & 5 deletions tests/it/wraps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
use std::io::SeekFrom;
use std::str::from_utf8;

use opendal::readers::CallbackReader;
use opendal::readers::ReaderStream;
use opendal::readers::SeekableReader;
use opendal::services::fs;
use opendal::Operator;
use futures::io::copy;
use futures::io::BufReader;
use futures::io::Cursor;
use futures::AsyncReadExt;
use futures::AsyncSeekExt;
use futures::StreamExt;
use opendal::readers::CallbackReader;
use opendal::readers::ReaderStream;
use opendal::readers::SeekableReader;
use opendal::services::fs;
use opendal::Operator;

#[tokio::test]
async fn reader_stream() {
Expand Down