Create a new [`StreamWriter`] from the commitlog in `repo`. Opens the latest segment of the commitlog for writing. If the commitlog is empty, no segment is created and [`Self::append_all`] expects that the source stream starts with a segment header. The method traverses the most recent segment to ensure it contains valid data, and to ensure [`Self::append_all`] can only write consecutive commits
(repo: R, commitlog_options: Options, on_trailing: OnTrailingData)
| 84 | /// commits. The `on_trailing` parameter an be used to trim the segment if |
| 85 | /// it contains trailing invalid data (i.e. due to a partial write). |
| 86 | pub fn create(repo: R, commitlog_options: Options, on_trailing: OnTrailingData) -> io::Result<Self> { |
| 87 | Self::create_and_metadata(repo, commitlog_options, on_trailing).map(|(this, _)| this) |
| 88 | } |
| 89 | |
| 90 | /// Like [`Self::create`], create a new [`StreamWriter`]. Additionally |
| 91 | /// return the [`segment::Metadata`] of the most recent segment. |