(stream: &mut S)
| 1325 | } |
| 1326 | |
| 1327 | async fn read_frame<T, S>(stream: &mut S) -> anyhow::Result<T> |
| 1328 | where |
| 1329 | T: for<'de> Deserialize<'de>, |
| 1330 | S: AsyncRead + Unpin, |
| 1331 | { |
| 1332 | let length = stream.read_u32().await? as usize; |
| 1333 | if length == 0 || length > MAX_FRAME_BYTES { |
| 1334 | return Err(anyhow!("invalid database-owner frame length {length}")); |
| 1335 | } |
| 1336 | let mut payload = vec![0; length]; |
| 1337 | stream.read_exact(&mut payload).await?; |
| 1338 | serde_json::from_slice(&payload).context("invalid database-owner JSON frame") |
| 1339 | } |
| 1340 | |
| 1341 | async fn write_frame<T, S>(stream: &mut S, value: &T) -> anyhow::Result<()> |
| 1342 | where |
no test coverage detected