From 4aa060228b13d3c06d68d8757b32518701413333 Mon Sep 17 00:00:00 2001 From: jiacai2050 Date: Tue, 10 Sep 2024 21:44:27 +0800 Subject: [PATCH] add Makefile --- .github/workflows/metric-engine-ci.yml | 65 ++++++++++++++++++++++++++ horaedb/Cargo.toml | 5 +- horaedb/Makefile | 28 +++++++++++ horaedb/metric_engine/src/storage.rs | 14 +++++- horaedb/server/src/main.rs | 1 - 5 files changed, 106 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/metric-engine-ci.yml create mode 100644 horaedb/Makefile diff --git a/.github/workflows/metric-engine-ci.yml b/.github/workflows/metric-engine-ci.yml new file mode 100644 index 0000000000..44a4b2bc83 --- /dev/null +++ b/.github/workflows/metric-engine-ci.yml @@ -0,0 +1,65 @@ +# 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: Metric Engine CI + +on: + merge_group: + workflow_dispatch: + push: + branches: + - main + - dev + paths: + - 'horaedb/**' + pull_request: + paths: + - 'src/**' + - 'horaedb/**' + +# Common environment variables +env: + RUSTFLAGS: "-C debuginfo=1" + CARGO_TERM_COLOR: always + RUST_BACKTRACE: "1" + LOCK_FILE: Cargo.lock + RUST_VERSION: nightly-2024-01-28 + +jobs: + style-check: + name: style-check + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - run: | + rustup set auto-self-update disable + rustup toolchain install ${RUST_VERSION} --profile minimal + - name: Release Disk Quota + run: | + sudo make ensure-disk-quota + - name: Install check binaries + run: | + rustup component add clippy + rustup component add rustfmt + cargo install --git https://github.com/DevinR528/cargo-sort --rev 55ec890 --locked + - name: Run Style Check + working-directory: horaedb + run: | + make fmt sort clippy diff --git a/horaedb/Cargo.toml b/horaedb/Cargo.toml index 7e629144e3..d0c24893d6 100644 --- a/horaedb/Cargo.toml +++ b/horaedb/Cargo.toml @@ -23,10 +23,7 @@ license = "Apache-2.0" [workspace] resolver = "2" -members = [ - "metric_engine", - "server", -] +members = ["metric_engine", "server"] [workspace.dependencies] anyhow = { version = "1.0" } diff --git a/horaedb/Makefile b/horaedb/Makefile new file mode 100644 index 0000000000..91039dda6e --- /dev/null +++ b/horaedb/Makefile @@ -0,0 +1,28 @@ +# 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. + +SHELL = /bin/bash + +clippy: + cargo clippy --all-targets --all-features -- -D warnings \ + -A dead_code -A unused_variables + +sort: + cargo sort --workspace --check + +fmt: + cargo fmt -- --check diff --git a/horaedb/metric_engine/src/storage.rs b/horaedb/metric_engine/src/storage.rs index 9f55fc85cb..b6fd840c34 100644 --- a/horaedb/metric_engine/src/storage.rs +++ b/horaedb/metric_engine/src/storage.rs @@ -31,7 +31,12 @@ pub struct CompactContext {} pub trait TMStorage { fn schema(&self) -> Result<&Schema>; async fn write(&self, batch: RecordBatch) -> Result<()>; - async fn scan(&self, range: TimeRange, predicate: Predicate) -> Result<()>; + async fn scan( + &self, + range: TimeRange, + predicate: Predicate, + projection: Vec, + ) -> Result; async fn compact(&self, ctx: CompactContext) -> Result<()>; } @@ -64,7 +69,12 @@ impl TMStorage for CloudObjectStorage { todo!() } - async fn scan(&self, range: TimeRange, predicate: Predicate) -> Result<()> { + async fn scan( + &self, + range: TimeRange, + predicate: Predicate, + projection: Vec, + ) -> Result { todo!() } diff --git a/horaedb/server/src/main.rs b/horaedb/server/src/main.rs index f3eb58bdc4..69260e1a8e 100644 --- a/horaedb/server/src/main.rs +++ b/horaedb/server/src/main.rs @@ -16,7 +16,6 @@ // under the License. use tracing::info; -use tracing_subscriber; fn main() { // install global collector configured based on RUST_LOG env var.