started query cancellation

This commit is contained in:
Lev Kokotov
2022-02-04 09:28:52 -08:00
parent 381f06d46f
commit 8e88c47f76
5 changed files with 101 additions and 7 deletions

View File

@@ -28,6 +28,19 @@ pub async fn server_parameters(stream: &mut TcpStream) -> Result<(), Error> {
Ok(write_all(stream, res).await?)
}
pub async fn backend_key_data(
stream: &mut TcpStream,
backend_id: i32,
secret_key: i32,
) -> Result<(), Error> {
let mut key_data = BytesMut::from(&b"K"[..]);
key_data.put_i32(12);
key_data.put_i32(backend_id);
key_data.put_i32(secret_key);
Ok(write_all(stream, key_data).await?)
}
pub async fn ready_for_query(stream: &mut TcpStream) -> Result<(), Error> {
let mut bytes = BytesMut::with_capacity(5);