Struct commitlog::message::Message
[−]
[src]
pub struct Message<'a> { /* fields omitted */ }
Messages contain finite-sized binary values with an offset from the beginning of the log.
Bytes | Encoding | Value |
---|---|---|
0-7 | Little Endian u64 | Offset |
8-11 | Little Endian u32 | Payload Size |
12-19 | Little Endian u64 | Sea Hash |
20+ | Payload |
Seahash is chosen because of its performance and quality. It is seeded
with the following constants:
0x16f11fe89b0d677c
, 0xb480a793d8e6c86c
, 0x6fe2e5aaf078ebc9
, 0x14f994a4c5259381
Methods
impl<'a> Message<'a>
[src]
fn hash(&self) -> u64
Seahash of the payload.
fn size(&self) -> u32
Size of the payload.
fn offset(&self) -> Offset
Offset of the message in the log.
fn payload(&self) -> &[u8]
Payload of the message.
fn verify_hash(&self) -> bool
Check that the hash matches the hash of the payload.
fn serialize<B: AsRef<[u8]>>(bytes: &mut Vec<u8>, offset: u64, payload: B)
Serializes a new message into a buffer