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

Method new

crates/runner-shared/src/artifacts/memtrack.rs:95–106  ·  view source on GitHub ↗
(writer: W)

Source from the content-addressed store, hash-verified

93
94impl<W: Write> MemtrackWriter<W> {
95 pub fn new(writer: W) -> anyhow::Result<Self> {
96 // We're dealing with a lot of events, so we want to compress as much as possible
97 // while not taking too much time to compress.
98 const COMPRESSION_LEVEL: i32 = 1;
99 const BUFFER_SIZE: usize = 256 * 1024 /* 256 KB */;
100
101 let writer = BufWriter::with_capacity(BUFFER_SIZE, writer);
102 let encoder = zstd::Encoder::new(writer, COMPRESSION_LEVEL)?;
103 Ok(Self {
104 serializer: rmp_serde::Serializer::new(encoder),
105 })
106 }
107
108 /// Write a single event to the stream
109 pub fn write_event(&mut self, event: &MemtrackEvent) -> anyhow::Result<()> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected