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

Function atom_change_file_version

atomic-repository/src/repository/changes.rs:9–22  ·  view source on GitHub ↗
(bytes: &[u8])

Source from the content-addressed store, hash-verified

7const ATOM_CHANGE_FILE_VERSION_SPAN: u32 = atomic_core::change::format_v3::SPAN_FORMAT_VERSION;
8
9fn atom_change_file_version(bytes: &[u8]) -> Result<u32, RepositoryError> {
10 if bytes.len() < ATOM_CHANGE_FILE_HEADER_LEN {
11 return Err(RepositoryError::Serialization(format!(
12 "change object is too short for an ATOM file header: expected at least {ATOM_CHANGE_FILE_HEADER_LEN} bytes, found {}",
13 bytes.len()
14 )));
15 }
16 if &bytes[..4] != ATOM_CHANGE_MAGIC {
17 return Err(RepositoryError::Serialization(
18 "change object does not begin with ATOM file-header magic".to_string(),
19 ));
20 }
21 Ok(u32::from_le_bytes([bytes[4], bytes[5], bytes[6], bytes[7]]))
22}
23
24impl Repository {
25 fn require_projected_semantic_storage_capability(

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected