Skip to main content

write_sequence

Function write_sequence 

Source
pub fn write_sequence(store: &Path, sequence: i64) -> Result<(), CaptureError>
Expand description

What: Writes the sequence file through a temporary file and a rename, so a reader sees the old number or the new one. Why: A crash after the rename leaves only a gap in the numbers.

In TS you’d write (pseudocode):

await writePrivateFile({ path: tmp, bytes }); await rename(tmp, join(store, 'sequence'));