Skip to content

Commit 5a483f6

Browse files
authored
chore: upgrade some packages (#20)
dashmap, greptime-proto, rand, snafu, derive-new
1 parent 84eb006 commit 5a483f6

File tree

5 files changed

+45
-13
lines changed

5 files changed

+45
-13
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ license = "Apache-2.0"
66
description = "A rust client for GreptimeDB gRPC protocol"
77

88
[dependencies]
9-
dashmap = "5.4"
9+
dashmap = "6.1"
1010
enum_dispatch = "0.3"
1111
futures = "0.3"
1212
futures-util = "0.3"
13-
greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git", tag = "v0.7.0" }
13+
greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git", tag = "v0.9.0" }
1414
parking_lot = "0.12"
1515
prost = "0.12"
16-
rand = "0.8"
17-
snafu = "0.7"
16+
rand = "0.9"
17+
snafu = "0.8"
1818
tokio = { version = "1", features = ["rt", "time"] }
1919
tokio-stream = { version = "0.1", features = ["net"] }
2020
tonic = { version = "0.11", features = ["tls", "tls-roots", "gzip", "zstd"] }
@@ -26,4 +26,4 @@ tonic-build = "0.9"
2626

2727
[dev-dependencies]
2828
tokio = { version = "1", features = ["full"] }
29-
derive-new = "0.5"
29+
derive-new = "0.7"

examples/ingest.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#![allow(clippy::print_stderr)]
16+
#![allow(clippy::print_stdout)]
17+
1518
use derive_new::new;
1619

1720
use greptimedb_ingester::api::v1::*;

examples/stream_ingest.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#![allow(clippy::print_stderr)]
16+
#![allow(clippy::print_stdout)]
17+
1518
use derive_new::new;
1619

1720
use greptimedb_ingester::api::v1::*;

src/error.rs

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,64 @@ use tonic::Status;
2121
#[snafu(visibility(pub))]
2222
pub enum Error {
2323
#[snafu(display("Invalid client tls config, {}", msg))]
24-
InvalidTlsConfig { msg: String },
24+
InvalidTlsConfig {
25+
msg: String,
26+
#[snafu(implicit)]
27+
location: Location,
28+
},
2529

2630
#[snafu(display("Invalid config file path, {}", source))]
2731
InvalidConfigFilePath {
2832
source: io::Error,
33+
#[snafu(implicit)]
2934
location: Location,
3035
},
3136

3237
#[snafu(display("Failed to create gRPC channel, source: {}", source))]
3338
CreateChannel {
3439
source: tonic::transport::Error,
40+
#[snafu(implicit)]
3541
location: Location,
3642
},
3743

3844
#[snafu(display("Unknown proto column datatype: {}", datatype))]
39-
UnknownColumnDataType { datatype: i32, location: Location },
45+
UnknownColumnDataType {
46+
datatype: i32,
47+
#[snafu(implicit)]
48+
location: Location,
49+
},
4050

4151
#[snafu(display("Illegal GRPC client state: {}", err_msg))]
42-
IllegalGrpcClientState { err_msg: String, location: Location },
52+
IllegalGrpcClientState {
53+
err_msg: String,
54+
#[snafu(implicit)]
55+
location: Location,
56+
},
4357

4458
#[snafu(display("Missing required field in protobuf, field: {}", field))]
45-
MissingField { field: String, location: Location },
59+
MissingField {
60+
field: String,
61+
#[snafu(implicit)]
62+
location: Location,
63+
},
4664

4765
// Server error carried in Tonic Status's metadata.
4866
#[snafu(display("{}", msg))]
4967
Server { status: Status, msg: String },
5068

5169
#[snafu(display("Illegal Database response: {err_msg}"))]
52-
IllegalDatabaseResponse { err_msg: String },
70+
IllegalDatabaseResponse {
71+
err_msg: String,
72+
#[snafu(implicit)]
73+
location: Location,
74+
},
5375

5476
#[snafu(display("Failed to send request with streaming: {}", err_msg))]
55-
ClientStreaming { err_msg: String, location: Location },
77+
ClientStreaming {
78+
err_msg: String,
79+
#[snafu(implicit)]
80+
location: Location,
81+
},
5682

5783
#[snafu(display("Failed to parse ascii string: {}", value))]
5884
InvalidAscii {

src/load_balance.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
use enum_dispatch::enum_dispatch;
16-
use rand::seq::SliceRandom;
16+
use rand::seq::IndexedRandom;
1717

1818
#[enum_dispatch]
1919
pub trait LoadBalance {
@@ -37,7 +37,7 @@ pub struct Random;
3737

3838
impl LoadBalance for Random {
3939
fn get_peer<'a>(&self, peers: &'a [String]) -> Option<&'a String> {
40-
peers.choose(&mut rand::thread_rng())
40+
peers.choose(&mut rand::rng())
4141
}
4242
}
4343

0 commit comments

Comments
 (0)