(
&self,
encoding_version: u8,
)
| 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. |
no test coverage detected