Skip to content

Commit ec47df5

Browse files
authored
fix: separate some modules from common_types (#1084)
## Rationale Some modules should not be set on the `common_types`. ## Detailed Changes - Move some modules from the `common_types` crate - Remove unnecessary features of `common_types` crate - Remove `test` feature and `tests` sub-module from `test_util` crate ## Test Plan Existing tests.
1 parent a26988b commit ec47df5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+452
-492
lines changed

Cargo.lock

+26-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+15-13
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ members = [
2424
"components/bytes_ext",
2525
"components/codec",
2626
"components/future_cancel",
27+
"components/hash_ext",
2728
"components/id_allocator",
2829
"components/logger",
2930
"components/macros",
@@ -69,6 +70,7 @@ name = "ceresdb-server"
6970
path = "src/bin/ceresdb-server.rs"
7071

7172
[workspace.dependencies]
73+
alloc_tracker = { path = "components/alloc_tracker" }
7274
arrow = { version = "38.0.0", features = ["prettyprint"] }
7375
arrow_ipc = { version = "38.0.0" }
7476
arrow_ext = { path = "components/arrow_ext" }
@@ -82,6 +84,7 @@ bytes_ext = { path = "components/bytes_ext" }
8284
catalog = { path = "catalog" }
8385
catalog_impls = { path = "catalog_impls" }
8486
ceresdbproto = "1.0"
87+
codec = { path = "components/codec" }
8588
chrono = "0.4"
8689
clap = "3.0"
8790
clru = "0.6.1"
@@ -91,23 +94,31 @@ common_types = { path = "common_types" }
9194
datafusion = { git = "https://github.com/ceresdb/arrow-datafusion.git", rev = "acb5d97a8a8de5296989740f97db3773fe3aa45a" }
9295
datafusion-proto = { git = "https://github.com/ceresdb/arrow-datafusion.git", rev = "acb5d97a8a8de5296989740f97db3773fe3aa45a" }
9396
df_operator = { path = "df_operator" }
97+
future_cancel = { path = "components/future_cancel" }
9498
etcd-client = "0.10.3"
9599
env_logger = "0.6"
96100
futures = "0.3"
97-
xorfilter-rs = { git = "https://github.com/CeresDB/xorfilter", rev = "ac8ef01" }
101+
generic_error = { path = "components/generic_error" }
102+
hash_ext = { path = "components/hash_ext" }
103+
hex = "0.4.3"
98104
lazy_static = "1.4.0"
99105
log = "0.4"
100106
logger = { path = "components/logger" }
101107
lru = "0.7.6"
108+
id_allocator = { path = "components/id_allocator" }
102109
influxql-logical-planner = { git = "https://github.com/CeresDB/influxql", rev = "b65a125b9cdfa3121a3c8843bc48441b91049e31", package = "iox_query_influxql" }
103110
influxql-parser = { git = "https://github.com/CeresDB/influxql", rev = "b65a125b9cdfa3121a3c8843bc48441b91049e31", package = "influxdb_influxql_parser" }
104111
influxql-query = { git = "https://github.com/CeresDB/influxql", rev = "b65a125b9cdfa3121a3c8843bc48441b91049e31", package = "iox_query" }
105112
influxql-schema = { git = "https://github.com/CeresDB/influxql", rev = "b65a125b9cdfa3121a3c8843bc48441b91049e31", package = "schema" }
106113
interpreters = { path = "interpreters" }
107114
itertools = "0.10.5"
108115
macros = { path = "components/macros" }
116+
message_queue = { path = "components/message_queue" }
109117
meta_client = { path = "meta_client" }
118+
metric_ext = { path = "components/metric_ext" }
110119
object_store = { path = "components/object_store" }
120+
panic_ext = { path = "components/panic_ext" }
121+
partitioned_lock = { path = "components/partitioned_lock" }
111122
partition_table_engine = { path = "partition_table_engine" }
112123
parquet_ext = { path = "components/parquet_ext" }
113124
parquet = { version = "38.0.0" }
@@ -139,29 +150,20 @@ system_catalog = { path = "system_catalog" }
139150
table_engine = { path = "table_engine" }
140151
table_kv = { path = "components/table_kv" }
141152
tempfile = "3.1.0"
142-
test_util = { path = "components/test_util", features = ["test"] }
153+
test_util = { path = "components/test_util" }
143154
time_ext = { path = "components/time_ext" }
144155
toml = "0.7"
145156
toml_ext = { path = "components/toml_ext" }
146-
generic_error = { path = "components/generic_error" }
147-
partitioned_lock = { path = "components/partitioned_lock" }
157+
timed_task = { path = "components/timed_task" }
148158
tracing_util = { path = "components/tracing_util" }
149159
trace_metric = { path = "components/trace_metric" }
150160
trace_metric_derive = { path = "components/trace_metric_derive" }
151161
trace_metric_derive_tests = { path = "components/trace_metric_derive_tests" }
152162
tonic = "0.8.1"
153163
tokio = { version = "1.25", features = ["full"] }
154164
wal = { path = "wal" }
155-
message_queue = { path = "components/message_queue" }
165+
xorfilter-rs = { git = "https://github.com/CeresDB/xorfilter", rev = "ac8ef01" }
156166
zstd = { version = "0.12", default-features = false }
157-
id_allocator = { path = "components/id_allocator" }
158-
panic_ext = { path = "components/panic_ext" }
159-
timed_task = { path = "components/timed_task" }
160-
future_cancel = { path = "components/future_cancel" }
161-
alloc_tracker = { path = "components/alloc_tracker" }
162-
metric_ext = { path = "components/metric_ext" }
163-
codec = { path = "components/codec" }
164-
hex = "0.4.3"
165167

166168
[dependencies]
167169
analytic_engine = { workspace = true }

analytic_engine/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ arrow = { workspace = true }
2121
async-stream = { workspace = true }
2222
async-trait = { workspace = true }
2323
base64 = { workspace = true }
24-
bytes = { workspace = true }
24+
bytes_ext = { workspace = true }
2525
ceresdbproto = { workspace = true }
2626
codec = { workspace = true }
2727
common_types = { workspace = true }

analytic_engine/src/compaction/picker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,8 @@ impl LevelPicker for TimeWindowPicker {
684684
mod tests {
685685
use std::time::Duration;
686686

687+
use bytes_ext::Bytes;
687688
use common_types::{
688-
bytes::Bytes,
689689
tests::build_schema,
690690
time::{TimeRange, Timestamp},
691691
};

analytic_engine/src/instance/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
//! Write logic of instance
44
5+
use bytes_ext::ByteVec;
56
use ceresdbproto::{schema as schema_pb, table_requests};
67
use codec::row;
78
use common_types::{
8-
bytes::ByteVec,
99
row::{RowGroup, RowGroupSlicer},
1010
schema::{IndexInWriterSchema, Schema},
1111
};

analytic_engine/src/manifest/details.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,6 @@ mod tests {
706706
use object_store::LocalFileSystem;
707707
use runtime::Runtime;
708708
use table_engine::table::{SchemaId, TableId, TableSeqGenerator};
709-
use test_util::tests::init_log_for_test;
710709
use wal::rocks_impl::manager::Builder as WalBuilder;
711710

712711
use super::*;
@@ -824,7 +823,7 @@ mod tests {
824823

825824
impl TestContext {
826825
fn new(prefix: &str, schema_id: SchemaId) -> Self {
827-
init_log_for_test();
826+
test_util::init_log_for_test();
828827
let dir = tempfile::Builder::new().prefix(prefix).tempdir().unwrap();
829828
let runtime = build_runtime(2);
830829

analytic_engine/src/manifest/meta_edit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use std::convert::TryFrom;
66

7-
use bytes::{Buf, BufMut};
7+
use bytes_ext::{Buf, BufMut};
88
use ceresdbproto::{manifest as manifest_pb, schema as schema_pb};
99
use common_types::{
1010
schema::{Schema, Version},

analytic_engine/src/memtable/key.rs

+7-12
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,9 @@
1212
1313
use std::mem;
1414

15-
use bytes::BufMut;
15+
use bytes_ext::{BufMut, BytesMut, SafeBuf, SafeBufMut};
1616
use codec::{memcomparable::MemComparable, Decoder, Encoder};
17-
use common_types::{
18-
bytes::{BytesMut, SafeBuf, SafeBufMut},
19-
row::Row,
20-
schema::Schema,
21-
SequenceNumber,
22-
};
17+
use common_types::{row::Row, schema::Schema, SequenceNumber};
2318
use macros::define_result;
2419
use snafu::{ensure, Backtrace, ResultExt, Snafu};
2520

@@ -29,19 +24,19 @@ pub enum Error {
2924
EncodeKeyDatum { source: codec::memcomparable::Error },
3025

3126
#[snafu(display("Failed to encode sequence, err:{}", source))]
32-
EncodeSequence { source: common_types::bytes::Error },
27+
EncodeSequence { source: bytes_ext::Error },
3328

3429
#[snafu(display("Failed to encode row index, err:{}", source))]
35-
EncodeIndex { source: common_types::bytes::Error },
30+
EncodeIndex { source: bytes_ext::Error },
3631

3732
#[snafu(display("Failed to decode sequence, err:{}", source))]
38-
DecodeSequence { source: common_types::bytes::Error },
33+
DecodeSequence { source: bytes_ext::Error },
3934

4035
#[snafu(display("Failed to decode row index, err:{}", source))]
41-
DecodeIndex { source: common_types::bytes::Error },
36+
DecodeIndex { source: bytes_ext::Error },
4237

4338
#[snafu(display(
44-
"Insufficent internal key length, len:{}.\nBacktrace:\n{}",
39+
"Insufficient internal key length, len:{}.\nBacktrace:\n{}",
4540
len,
4641
backtrace
4742
))]

analytic_engine/src/memtable/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ pub mod skiplist;
88

99
use std::{ops::Bound, sync::Arc, time::Instant};
1010

11+
use bytes_ext::{ByteVec, Bytes};
1112
use common_types::{
12-
bytes::{ByteVec, Bytes},
1313
projected_schema::ProjectedSchema,
1414
record_batch::RecordBatchWithKey,
1515
row::Row,

analytic_engine/src/memtable/skiplist/iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
use std::{cmp::Ordering, iter::Rev, ops::Bound, time::Instant};
66

77
use arena::{Arena, BasicStats};
8+
use bytes_ext::{Bytes, BytesMut};
89
use codec::row;
910
use common_types::{
10-
bytes::{Bytes, BytesMut},
1111
projected_schema::{ProjectedSchema, RowProjector},
1212
record_batch::{RecordBatchWithKey, RecordBatchWithKeyBuilder},
1313
row::contiguous::{ContiguousRowReader, ProjectedContiguousRow},

0 commit comments

Comments
 (0)