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

Function encode_file_index

atomic-core/src/pristine/tables.rs:547–559  ·  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

545/// Packs (mtime_secs, mtime_nanos, file_size, content_hash) into 52 bytes.
546#[inline]
547pub fn encode_file_index(
548 mtime_secs: i64,
549 mtime_nanos: u32,
550 file_size: u64,
551 content_hash: &crate::types::Hash,
552) -> [u8; 52] {
553 let mut value = [0u8; 52];
554 value[0..8].copy_from_slice(&mtime_secs.to_le_bytes());
555 value[8..12].copy_from_slice(&mtime_nanos.to_le_bytes());
556 value[12..20].copy_from_slice(&file_size.to_le_bytes());
557 value[20..52].copy_from_slice(&content_hash.0);
558 value
559}
560
561/// Decode file metadata from the FILE_INDEX table.
562///

Callers 1

put_file_indexMethod · 0.85

Calls 1

to_le_bytesMethod · 0.80

Tested by

no test coverage detected