Skip to content

Commit

Permalink
feat: add server config (apache#1615)
Browse files Browse the repository at this point in the history
## Rationale


## Detailed Changes
- Server can read config from cli args
- Start 4 write worker to bench write.

## Test Plan
CI
  • Loading branch information
jiacai2050 authored Dec 20, 2024
1 parent 8d3a9ab commit d2f878f
Show file tree
Hide file tree
Showing 18 changed files with 1,039 additions and 137 deletions.
36 changes: 36 additions & 0 deletions Cargo.lock

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

10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ license = "Apache-2.0"

[workspace]
resolver = "2"
members = ["src/benchmarks", "src/metric_engine", "src/pb_types", "src/server"]
members = [
"src/benchmarks",
"src/common",
"src/metric_engine",
"src/pb_types",
"src/server"
]

[workspace.dependencies]
anyhow = { version = "1.0" }
metric_engine = { path = "src/metric_engine" }
common = { path = "src/common" }
thiserror = "1"
bytes = "1"
byteorder = "1"
Expand All @@ -38,6 +45,7 @@ pb_types = { path = "src/pb_types" }
prost = { version = "0.13" }
arrow = { version = "53", features = ["prettyprint"] }
bytesize = "1"
clap = "4"
arrow-schema = "53"
tokio = { version = "1", features = ["full"] }
async-trait = "0.1"
Expand Down
24 changes: 24 additions & 0 deletions docs/example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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.

port = 5000

[metric_engine]

[metric_engine.storage]
type = "Local"
data_dir = "/tmp/horaedb-storage"
26 changes: 2 additions & 24 deletions licenserc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,6 @@
headerPath = "Apache-2.0-ASF.txt"

excludes = [
# Derived
"horaemeta/server/coordinator/scheduler/nodepicker/hash/consistent_uniform_test.go",
"horaemeta/server/coordinator/scheduler/nodepicker/hash/consistent_uniform.go",
"horaemeta/server/service/http/route.go",
"src/server/src/federated.rs",
"src/server/src/session.rs",
"src/components/skiplist/benches/bench.rs",
"src/components/skiplist/src/lib.rs",
"src/components/skiplist/src/key.rs",
"src/components/skiplist/src/list.rs",
"src/components/skiplist/tests/tests.rs",
"src/components/skiplist/Cargo.toml",
"src/components/size_ext/src/lib.rs",
"src/components/future_ext/src/cancel.rs",
"src/components/tracing_util/src/lib.rs",
"src/components/tracing_util/src/logging.rs",
"src/components/tracing_util/Cargo.toml",
"DISCLAIMER",
"NOTICE",
"horaemeta/DEPENDENCIES.csv",
"DEPENDENCIES.tsv",
# Test files
"*snap",
"*result"
# Forked
"src/common/src/size_ext.rs",
]
1 change: 1 addition & 0 deletions src/benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ workspace = true

[dependencies]
bytes = { workspace = true }
common = { workspace = true }
metric_engine = { workspace = true }
pb_types = { workspace = true }
prost = { workspace = true }
Expand Down
3 changes: 1 addition & 2 deletions src/benchmarks/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
use std::{env, fs};

use common::ReadableDuration;
use serde::Deserialize;
use tracing::info;

use crate::util::ReadableDuration;
const BENCH_CONFIG_PATH_KEY: &str = "BENCH_CONFIG_PATH";

#[derive(Debug, Deserialize)]
Expand Down
35 changes: 35 additions & 0 deletions src/common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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.

[package]
name = "common"

[package.license]
workspace = true

[package.version]
workspace = true

[package.authors]
workspace = true

[package.edition]
workspace = true

[dependencies]
serde = { workspace = true }
toml = { workspace = true }
11 changes: 4 additions & 7 deletions src/metric_engine/src/util.rs → src/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
// specific language governing permissions and limitations
// under the License.

use std::time::{SystemTime, UNIX_EPOCH};
mod size_ext;
mod time_ext;

/// Current time in milliseconds.
pub fn now() -> i64 {
let now = SystemTime::now();
let duration = now.duration_since(UNIX_EPOCH).unwrap();
duration.as_millis() as i64
}
pub use size_ext::ReadableSize;
pub use time_ext::{now, ReadableDuration};
Loading

0 comments on commit d2f878f

Please sign in to comment.