Force the currently active segment to be flushed to storage. Using a filesystem backend, this means to call `fsync(2)`. Note** that this does not flush the buffered data from calls to [Self::commit], it only instructs the underlying storage to flush its buffers. Call [Self::flush] prior to this method to ensure data from all previous [Self::commit] calls is flushed to the underlying storage. #
(&mut self)
| 133 | /// this method panics in this case, thereby preventing any further writes |
| 134 | /// to the log and forcing the user to re-read the state from disk. |
| 135 | pub fn sync(&mut self) { |
| 136 | self.panicked = true; |
| 137 | if let Err(e) = self.head.fsync() { |
| 138 | panic!("Failed to fsync segment: {e}"); |
| 139 | } |
| 140 | self.panicked = false; |
| 141 | } |
| 142 | |
| 143 | /// Flush the buffered data from previous calls to [Self::commit] to the |
| 144 | /// underlying storage. |
no test coverage detected