Skip to content

Commit

Permalink
add pb_types
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Oct 22, 2024
1 parent aca1abf commit 7cd99c9
Show file tree
Hide file tree
Showing 7 changed files with 224 additions and 17 deletions.
105 changes: 91 additions & 14 deletions horaedb/Cargo.lock

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

2 changes: 1 addition & 1 deletion horaedb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ license = "Apache-2.0"

[workspace]
resolver = "2"
members = ["metric_engine", "server"]
members = ["metric_engine", "pb_types", "server"]

[workspace.dependencies]
anyhow = { version = "1.0" }
Expand Down
2 changes: 0 additions & 2 deletions horaedb/metric_engine/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ pub struct Manifest {
store: ObjectStoreRef,
}

struct Inner {}

impl Manifest {
pub async fn try_new(path: String, store: ObjectStoreRef) -> Result<Self> {
let snapshot_path = Path::from(format!("{path}/{SNAPSHOT_FILENAME}"));
Expand Down
37 changes: 37 additions & 0 deletions horaedb/pb_types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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 = "pb_types"

[package.license]
workspace = true

[package.version]
workspace = true

[package.authors]
workspace = true

[package.edition]
workspace = true

[dependencies]
prost = "0.13"

[build-dependencies]
prost-build = { version = "0.13" }
23 changes: 23 additions & 0 deletions horaedb/pb_types/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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.

use std::io::Result;

fn main() -> Result<()> {
prost_build::compile_protos(&["protos/sst.proto"], &["protos/"])?;
Ok(())
}
50 changes: 50 additions & 0 deletions horaedb/pb_types/protos/sst.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* 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.
*/

syntax = "proto3";

package pb_types.sst;

// Time range of [start, end)
message TimeRange {
// inclusive
int64 start = 1;
// exclusive
int64 end = 2;
}

message SstMeta {
uint64 max_sequence = 1;
uint32 num_rows = 2;
TimeRange time_range = 3;
}

message SstFile {
uint64 id = 1;
SstMeta meta = 2;
}

message Manifest {
repeated SstFile files = 1;
}

message MetaUpdate {
repeated SstFile to_adds = 1;
repeated uint64 to_removes = 2;
}
22 changes: 22 additions & 0 deletions horaedb/pb_types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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.

mod pb_types {
include!(concat!(env!("OUT_DIR"), "/pb_types.sst.rs"));
}

pub use pb_types::*;

0 comments on commit 7cd99c9

Please sign in to comment.