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

Method put_blob

atomic-core/src/operation/codec.rs:351–361  ·  view source on GitHub ↗
(&mut self, value: &[u8], field: &str)

Source from the content-addressed store, hash-verified

349 }
350
351 fn put_blob(&mut self, value: &[u8], field: &str) -> Result<(), OperationCodecError> {
352 if value.len() > MAX_OPERATION_OBJECT_BYTES {
353 return Err(OperationCodecError::new(format!(
354 "{field} exceeds {MAX_OPERATION_OBJECT_BYTES} bytes"
355 )));
356 }
357 let len = u32::try_from(value.len())
358 .map_err(|_| OperationCodecError::new(format!("{field} length exceeds u32")))?;
359 self.put_u32(len)?;
360 self.put_bytes(value)
361 }
362
363 fn put_hash(&mut self, value: Hash) -> Result<(), OperationCodecError> {
364 self.put_bytes(value.as_bytes())

Callers 1

put_metadata_valueMethod · 0.80

Calls 3

put_u32Method · 0.80
put_bytesMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected