Skip to content

Commit

Permalink
Upgrade to protobuf 3.7.1
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Reber <[email protected]>
  • Loading branch information
adrianreber committed Dec 18, 2024
1 parent b87cb0c commit 9524075
Show file tree
Hide file tree
Showing 10 changed files with 278 additions and 219 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get install -y protobuf-compiler
- name: Build
run: cargo build --verbose
- name: Run clippy
Expand Down
93 changes: 78 additions & 15 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ hyper = { version = "0.14", features = ["server", "http1", "http2", "runtime"] }
log = "0.4"
pretty_env_logger = "0.5"
chrono = "0.4"
protobuf = "2.14.0"
url = "2.5.2"
protobuf = "3.7.1"
url = "2.3.1"
regex = "1"
ipnet = "2.9.0"
treebitmap = "0.4.0"
Expand All @@ -35,7 +35,7 @@ version = "1.29.1"
features = ["macros", "rt-multi-thread"]

[build-dependencies]
protobuf-codegen-pure = "2.14.0"
protobuf-codegen = "3.7.1"

[dev-dependencies]
tempfile = "3.10.1"
7 changes: 3 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
extern crate protobuf_codegen_pure;
extern crate protobuf_codegen;

fn main() {
protobuf_codegen_pure::Codegen::new()
protobuf_codegen::Codegen::new()
.out_dir("src/bin/common/protos")
.inputs(["protos/mirrormanager.proto"])
.include("protos")
.run()
.expect("Codegen failed.");
.run_from_script();
}
28 changes: 14 additions & 14 deletions src/bin/common/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub fn find_in_file_details_cache_directory_cache(
dir: &str,
) -> i64 {
for (index, e) in fdcdc.iter().enumerate() {
if e.get_directory() == dir {
if e.directory() == dir {
return index as i64;
}
}
Expand All @@ -18,7 +18,7 @@ pub fn find_in_file_details_cache_directory_cache(

pub fn find_in_mirrorlist_cache(mlc: &[MirrorListCacheType], dir: &str) -> i64 {
for (index, mirrorlist_cache) in mlc.iter().enumerate() {
if mirrorlist_cache.get_directory() == dir {
if mirrorlist_cache.directory() == dir {
return index as i64;
}
}
Expand All @@ -28,43 +28,43 @@ pub fn find_in_mirrorlist_cache(mlc: &[MirrorListCacheType], dir: &str) -> i64 {
pub fn find_in_string_string_map(ssm: &[StringStringMap], key: &str) -> String {
let mut result = String::new();
for param in ssm {
if param.get_key() == key {
result.push_str(param.get_value());
if param.key() == key {
result.push_str(param.value());
}
}
result
}

pub fn find_in_string_bool_map(sbm: &[StringBoolMap], key: &str) -> bool {
for param in sbm {
if param.get_key() == key {
return param.get_value();
if param.key() == key {
return param.value();
}
}
false
}

pub fn find_in_int_int_map(iim: &[IntIntMap], key: i64) -> i64 {
for e in iim {
if e.get_key() == key {
return e.get_value();
if e.key() == key {
return e.value();
}
}
0
}

pub fn find_in_int_string_map(ism: &[IntStringMap], key: i64) -> String {
for e in ism {
if e.get_key() == key {
return String::from(e.get_value());
if e.key() == key {
return String::from(e.value());
}
}
String::new()
}

pub fn find_in_int_repeated_string_map(irsm: &[IntRepeatedStringMap], key: i64) -> i64 {
for (index, param) in irsm.iter().enumerate() {
if param.get_key() == key {
if param.key() == key {
return index as i64;
}
}
Expand All @@ -73,7 +73,7 @@ pub fn find_in_int_repeated_string_map(irsm: &[IntRepeatedStringMap], key: i64)

pub fn find_in_int_repeated_int_map(irim: &[IntRepeatedIntMap], key: i64) -> i64 {
for (index, param) in irim.iter().enumerate() {
if param.get_key() == key {
if param.key() == key {
return index as i64;
}
}
Expand All @@ -82,7 +82,7 @@ pub fn find_in_int_repeated_int_map(irim: &[IntRepeatedIntMap], key: i64) -> i64

pub fn find_in_string_repeated_int_map(irim: &[StringRepeatedIntMap], key: &str) -> i64 {
for (index, param) in irim.iter().enumerate() {
if param.get_key() == key {
if param.key() == key {
return index as i64;
}
}
Expand All @@ -94,7 +94,7 @@ pub fn find_in_file_details_cache_files_cache(
file: &str,
) -> i64 {
for (index, e) in fdcfc.iter().enumerate() {
if e.get_filename() == file {
if e.filename() == file {
return index as i64;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/bin/common/protos/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// @generated

pub mod mirrormanager;
Loading

0 comments on commit 9524075

Please sign in to comment.