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>,
)
| 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, |