MCPcopy Index your code
hub / github.com/Firstyear/opensuse-proxy-cache / insert_bytes

Method insert_bytes

arc-disk-cache/src/lib.rs:546–563  ·  view source on GitHub ↗
(&self, k: K, d: D, bytes: &[u8])

Source from the content-addressed store, hash-verified

544 }
545
546 pub fn insert_bytes(&self, k: K, d: D, bytes: &[u8]) {
547 let mut fh = match self.new_tempfile() {
548 Some(fh) => fh,
549 None => return,
550 };
551
552 if let Err(e) = fh.write(bytes) {
553 error!(?e, "failed to write bytes to file");
554 return;
555 };
556
557 if let Err(e) = fh.flush() {
558 error!(?e, "failed to flush bytes to file");
559 return;
560 }
561
562 self.insert(k, d, fh)
563 }
564
565 // Add an item?
566 pub fn insert(&self, k: K, d: D, mut fh: NamedTempFile) {

Callers

nothing calls this directly

Calls 2

new_tempfileMethod · 0.80
insertMethod · 0.80

Tested by

no test coverage detected