Open the log at root directory `root` with [`Options`]. The root directory must already exist. Note that opening a commitlog involves I/O: some consistency checks are performed, and the next writing position is determined. This is only necessary when opening the commitlog for writing. See the free-standing functions in this module for how to traverse a read-only commitlog.
(root: CommitLogDir, opts: Options, on_new_segment: Option<Arc<OnNewSegmentFn>>)
| 180 | /// free-standing functions in this module for how to traverse a read-only |
| 181 | /// commitlog. |
| 182 | pub fn open(root: CommitLogDir, opts: Options, on_new_segment: Option<Arc<OnNewSegmentFn>>) -> io::Result<Self> { |
| 183 | #[cfg(not(feature = "fallocate"))] |
| 184 | if opts.preallocate_segments { |
| 185 | log::warn!( |
| 186 | "`preallocate_segments` enabled but not supported by this build. commitlog-dir={}", |
| 187 | root.display() |
| 188 | ); |
| 189 | } |
| 190 | Self::open_with_repo(repo::Fs::new(root, on_new_segment)?, opts) |
| 191 | } |
| 192 | |
| 193 | /// Determine the size on disk of this commitlog. |
| 194 | pub fn size_on_disk(&self) -> io::Result<SizeOnDisk> { |