MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / write

Method write

src/instruments/otel/receiver.rs:389–411  ·  view source on GitHub ↗
(
        &self,
        signal: Signal,
        encoding: Encoding,
        body: &[u8],
        received_bytes: u64,
    )

Source from the content-addressed store, hash-verified

387 }
388
389 async fn write(
390 &self,
391 signal: Signal,
392 encoding: Encoding,
393 body: &[u8],
394 received_bytes: u64,
395 ) -> Result<()> {
396 tokio::fs::create_dir_all(&self.dir)
397 .await
398 .with_context(|| format!("Failed to create {}", self.dir.display()))?;
399
400 let sequence = self.next_sequence.fetch_add(1, Ordering::Relaxed);
401 let path = self
402 .dir
403 .join(StoredRequest::file_name(sequence, signal, encoding));
404 tokio::fs::write(&path, body)
405 .await
406 .with_context(|| format!("Failed to write {}", path.display()))?;
407
408 self.received_bytes
409 .fetch_add(received_bytes, Ordering::Relaxed);
410 Ok(())
411 }
412
413 fn requests(&self) -> u64 {
414 self.next_sequence.load(Ordering::Relaxed)

Callers 2

handleFunction · 0.45
open_fifo_rdwrFunction · 0.45

Calls 1

writeFunction · 0.85

Tested by

no test coverage detected