MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / open_segment_writer

Method open_segment_writer

crates/commitlog/src/repo/fs.rs:294–300  ·  view source on GitHub ↗
(&self, offset: u64)

Source from the content-addressed store, hash-verified

292 }
293
294 fn open_segment_writer(&self, offset: u64) -> io::Result<Self::SegmentWriter> {
295 // NOTE: We previously used `O_APPEND`, but Windows demands `write(true)`
296 // so that we can truncate trailing garbage in [super::resume_segment_writer].
297 let mut file = File::options().read(true).write(true).open(self.segment_path(offset))?;
298 file.seek(io::SeekFrom::End(0))?;
299 Ok(file)
300 }
301
302 fn segment_file_path(&self, offset: u64) -> Option<String> {
303 Some(self.segment_path(offset).0.to_string_lossy().into_owned())

Callers 6

reset_to_internalFunction · 0.45
create_and_metadataMethod · 0.45
create_segmentFunction · 0.45
resume_empty_segmentFunction · 0.45
trim_garbageFunction · 0.45

Calls 6

segment_pathMethod · 0.80
openMethod · 0.65
OkFunction · 0.50
writeMethod · 0.45
readMethod · 0.45
seekMethod · 0.45

Tested by 3

resume_empty_segmentFunction · 0.36
trim_garbageFunction · 0.36