MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / new

Method new

nodedb/src/storage/segment.rs:43–56  ·  view source on GitHub ↗

Create a new footer for a segment.

(created_by: &str, checksum: u32, min_lsn: Lsn, max_lsn: Lsn)

Source from the content-addressed store, hash-verified

41impl SegmentFooter {
42 /// Create a new footer for a segment.
43 pub fn new(created_by: &str, checksum: u32, min_lsn: Lsn, max_lsn: Lsn) -> Self {
44 let mut cb = [0u8; 32];
45 let bytes = created_by.as_bytes();
46 let len = bytes.len().min(32);
47 cb[..len].copy_from_slice(&bytes[..len]);
48
49 Self {
50 format_version: FORMAT_VERSION,
51 created_by: cb,
52 checksum,
53 min_lsn,
54 max_lsn,
55 }
56 }
57
58 /// Serialize the footer to bytes.
59 pub fn to_bytes(&self) -> [u8; FOOTER_SIZE] {

Callers

nothing calls this directly

Calls 2

as_bytesMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected