Skip to content

Commit bfcbe7c

Browse files
lubennikovaavconradludgate
authored andcommitted
Extend replication protocol with ZenithStatusUpdate message
1 parent c79c9ef commit bfcbe7c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tokio-postgres/src/replication.rs

+17
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use std::time::SystemTime;
1414

1515
const STANDBY_STATUS_UPDATE_TAG: u8 = b'r';
1616
const HOT_STANDBY_FEEDBACK_TAG: u8 = b'h';
17+
const ZENITH_STATUS_UPDATE_TAG_BYTE: u8 = b'z';
1718

1819
pin_project! {
1920
/// A type which deserializes the postgres replication protocol. This type can be used with
@@ -33,6 +34,22 @@ impl ReplicationStream {
3334
Self { stream }
3435
}
3536

37+
/// Send zenith status update to server.
38+
pub async fn zenith_status_update(
39+
self: Pin<&mut Self>,
40+
len: u64,
41+
data: &[u8],
42+
) -> Result<(), Error> {
43+
let mut this = self.project();
44+
45+
let mut buf = BytesMut::new();
46+
buf.put_u8(ZENITH_STATUS_UPDATE_TAG_BYTE);
47+
buf.put_u64(len);
48+
buf.put_slice(data);
49+
50+
this.stream.send(buf.freeze()).await
51+
}
52+
3653
/// Send standby update to server.
3754
pub async fn standby_status_update(
3855
self: Pin<&mut Self>,

0 commit comments

Comments
 (0)