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

Function database_id_roundtrip

nodedb-wal/src/record/header.rs:215–232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

213
214 #[test]
215 fn database_id_roundtrip() {
216 // Non-zero database_id survives to_bytes → from_bytes.
217 let header = RecordHeader {
218 magic: WAL_MAGIC,
219 format_version: WAL_FORMAT_VERSION,
220 record_type: 1,
221 lsn: 1,
222 tenant_id: 42,
223 vshard_id: 0,
224 payload_len: 0,
225 database_id: 7,
226 reserved: [0u8; 8],
227 crc32c: 0,
228 };
229 let bytes = header.to_bytes();
230 let decoded = RecordHeader::from_bytes(&bytes);
231 assert_eq!(decoded.database_id, 7);
232 }
233
234 #[test]
235 fn pre_tier2_zero_database_id_compat() {

Callers

nothing calls this directly

Calls 1

to_bytesMethod · 0.45

Tested by

no test coverage detected