(&self)
| 72 | |
| 73 | impl RecordHeader { |
| 74 | pub fn to_bytes(&self) -> [u8; HEADER_SIZE] { |
| 75 | let mut buf = [0u8; HEADER_SIZE]; |
| 76 | buf[0..4].copy_from_slice(&self.magic.to_le_bytes()); |
| 77 | buf[4..6].copy_from_slice(&self.format_version.to_le_bytes()); |
| 78 | buf[6..10].copy_from_slice(&self.record_type.to_le_bytes()); |
| 79 | buf[10..18].copy_from_slice(&self.lsn.to_le_bytes()); |
| 80 | buf[18..26].copy_from_slice(&self.tenant_id.to_le_bytes()); |
| 81 | buf[26..30].copy_from_slice(&self.vshard_id.to_le_bytes()); |
| 82 | buf[30..34].copy_from_slice(&self.payload_len.to_le_bytes()); |
| 83 | buf[34..42].copy_from_slice(&self.database_id.to_le_bytes()); |
| 84 | buf[42..50].copy_from_slice(&self.reserved); |
| 85 | buf[50..54].copy_from_slice(&self.crc32c.to_le_bytes()); |
| 86 | buf |
| 87 | } |
| 88 | |
| 89 | pub fn from_bytes(buf: &[u8; HEADER_SIZE]) -> Self { |
| 90 | let mut reserved = [0u8; 8]; |
no outgoing calls