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

Method commit

crates/commitlog/src/commitlog.rs:309–324  ·  view source on GitHub ↗

Write `transactions` to the log. This will store all `transactions` as a single [Commit] (note that `transactions` must not yield more than [u16::MAX] elements). Data is buffered by the underlying segment [Writer]. Call [Self::flush] to force flushing to the underlying storage. If, after writing the transactions, the writer's total written bytes exceed [Options::max_segment_size], the current s

(
        &mut self,
        transactions: impl IntoIterator<Item = U>,
    )

Source from the content-addressed store, hash-verified

307 ///
308 /// - [Self::sync] panics (called when rotating segments)
309 pub fn commit<U: Into<Transaction<T>>>(
310 &mut self,
311 transactions: impl IntoIterator<Item = U>,
312 ) -> io::Result<Option<Committed>> {
313 self.panicked = true;
314 let writer = &mut self.head;
315 let committed = writer.commit(transactions)?;
316 if writer.len() >= self.opts.max_segment_size {
317 self.flush().expect("failed to flush segment upon rotation");
318 self.sync();
319 self.start_new_segment()?;
320 }
321 self.panicked = false;
322
323 Ok(committed)
324 }
325
326 pub fn transactions_from<'a, D>(
327 &self,

Callers

nothing calls this directly

Calls 6

start_new_segmentMethod · 0.80
commitMethod · 0.65
OkFunction · 0.50
lenMethod · 0.45
flushMethod · 0.45
syncMethod · 0.45

Tested by

no test coverage detected