Update the current epoch. Does nothing if the given `epoch` is equal to the current epoch. # Errors If `epoch` is smaller than the current epoch, an error of kind [`io::ErrorKind::InvalidInput`] is returned.
(&mut self, epoch: u64)
| 108 | /// If `epoch` is smaller than the current epoch, an error of kind |
| 109 | /// [`io::ErrorKind::InvalidInput`] is returned. |
| 110 | pub fn set_epoch(&mut self, epoch: u64) -> io::Result<()> { |
| 111 | if epoch < self.head.epoch() { |
| 112 | return Err(io::Error::new( |
| 113 | io::ErrorKind::InvalidInput, |
| 114 | "new epoch is smaller than current epoch", |
| 115 | )); |
| 116 | } |
| 117 | self.head.set_epoch(epoch); |
| 118 | Ok(()) |
| 119 | } |
| 120 | |
| 121 | /// Force the currently active segment to be flushed to storage. |
| 122 | /// |