MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / encode_file_index

Function encode_file_index

atomic-core/src/pristine/tables.rs:349–361  ·  view source on GitHub ↗
(
    mtime_secs: i64,
    mtime_nanos: u32,
    file_size: u64,
    content_hash: &crate::types::Hash,
)

Source from the content-addressed store, hash-verified

347/// Packs (mtime_secs, mtime_nanos, file_size, content_hash) into 52 bytes.
348#[inline]
349pub fn encode_file_index(
350 mtime_secs: i64,
351 mtime_nanos: u32,
352 file_size: u64,
353 content_hash: &crate::types::Hash,
354) -> [u8; 52] {
355 let mut value = [0u8; 52];
356 value[0..8].copy_from_slice(&mtime_secs.to_le_bytes());
357 value[8..12].copy_from_slice(&mtime_nanos.to_le_bytes());
358 value[12..20].copy_from_slice(&file_size.to_le_bytes());
359 value[20..52].copy_from_slice(&content_hash.0);
360 value
361}
362
363/// Decode file metadata from the FILE_INDEX table.
364///

Callers 1

put_file_indexMethod · 0.85

Calls 1

to_le_bytesMethod · 0.80

Tested by

no test coverage detected