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

Method validate_encoding_version

atomic-core/src/operation/mod.rs:280–299  ·  view source on GitHub ↗
(
        &self,
        encoding_version: u8,
    )

Source from the content-addressed store, hash-verified

278 }
279
280 pub(crate) fn validate_encoding_version(
281 &self,
282 encoding_version: u8,
283 ) -> Result<(), OperationCodecError> {
284 match encoding_version {
285 OPERATION_VERSION_V1
286 if self.kind.requires_v2()
287 || self.relation.is_some()
288 || !self.delta.metadata.is_empty() =>
289 {
290 Err(OperationCodecError::new(
291 "operation payload requires canonical encoding version 2",
292 ))
293 }
294 OPERATION_VERSION_V1 | OPERATION_VERSION_V2 => Ok(()),
295 version => Err(OperationCodecError::new(format!(
296 "unsupported operation version {version} (maximum supported version {OPERATION_VERSION})"
297 ))),
298 }
299 }
300}
301
302/// Content-addressed immutable repository operation.

Callers 3

encode_operation_payloadFunction · 0.80
decode_operationFunction · 0.80

Calls 2

requires_v2Method · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected