Skip to content

Commit acbe2ba

Browse files
RUST-1571 Update ServerId to be int64 (mongodb#894)
* RUST-1571 Update ServerId to be int64 Co-authored-by: Isabel Atkinson <[email protected]>
1 parent e71aa72 commit acbe2ba

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/cmap/conn/mod.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,15 @@ pub struct ConnectionInfo {
4747

4848
/// A server-generated identifier that uniquely identifies the connection. Available on server
4949
/// versions 4.2+. This may be used to correlate driver connections with server logs.
50+
/// If the connection ID sent by the server is too large for an i32, this will be a truncated
51+
/// value.
5052
pub server_id: Option<i32>,
5153

54+
/// A server-generated identifier that uniquely identifies the connection. Available on server
55+
/// versions 4.2+. This may be used to correlate driver connections with server logs. This
56+
/// value will not be truncated and should be used rather than `server_id`.
57+
pub server_id_i64: Option<i64>,
58+
5259
/// The address that the connection is connected to.
5360
pub address: ServerAddress,
5461
}
@@ -60,7 +67,7 @@ pub(crate) struct Connection {
6067
/// Driver-generated ID for the connection.
6168
pub(super) id: u32,
6269
/// Server-generated ID for the connection.
63-
pub(crate) server_id: Option<i32>,
70+
pub(crate) server_id: Option<i64>,
6471

6572
pub(crate) address: ServerAddress,
6673
pub(crate) generation: ConnectionGeneration,
@@ -165,7 +172,8 @@ impl Connection {
165172
pub(crate) fn info(&self) -> ConnectionInfo {
166173
ConnectionInfo {
167174
id: self.id,
168-
server_id: self.server_id,
175+
server_id: self.server_id.map(|value| value as i32),
176+
server_id_i64: self.server_id,
169177
address: self.address.clone(),
170178
}
171179
}

src/hello.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ pub(crate) struct HelloCommandResponse {
179179

180180
/// The server-generated ID for the connection the "hello" command was run on.
181181
/// Present on server versions 4.2+.
182-
pub connection_id: Option<i32>,
182+
pub connection_id: Option<i64>,
183183
}
184184

185185
impl HelloCommandResponse {

0 commit comments

Comments
 (0)