Struct commitlog::Message
[−]
[src]
pub struct Message { /* fields omitted */ }Messages are appended to the log with the following encoding:
| Bytes | Encoding | Value |
|---|---|---|
| 0-7 | Big Endian u64 | Offset |
| 8-11 | Big Endian u32 | Payload Size |
| 12-15 | Big Endian u32 | CRC32 (IEEE) |
| 16+ | Payload |
Methods
impl Message[src]
fn new(payload: &[u8], offset: u64) -> Message
Creates a new message with a given payload and offset.
fn read<R>(reader: &mut R) -> Result<Message, MessageError> where R: Read
Reads a single message.
fn bytes(&self) -> &[u8]
Serialized representation of the message, in bytes.
fn crc(&self) -> u32
IEEE CRC32 of the payload.
fn size(&self) -> u32
Size of the payload.
fn offset(&self) -> u64
Offset of the message in the log.
fn payload(&self) -> &[u8]
Payload of the message.