Compress the segments at the offsets provided, marking them as immutable. `offsets` must contain the exact segment offsets, no rounding to the nearest offset is performed. If a segment is not found on disk, an error is returned and no further segments from the list are processed. The latest, writable segment will not be compressed. If `offsets` contains its offset, an error is returned. This me
(&self, offsets: &[u64])
| 378 | /// small overhead to open the file and determining its format, but |
| 379 | /// otherwise does nothing. |
| 380 | pub fn compress_segments(&self, offsets: &[u64]) -> io::Result<CompressionStats> { |
| 381 | let (repo, head_offset) = { |
| 382 | let inner = self.inner.read().unwrap(); |
| 383 | let repo = inner.repo.clone(); |
| 384 | let head_offset = inner.head.min_tx_offset(); |
| 385 | |
| 386 | (repo, head_offset) |
| 387 | }; |
| 388 | if offsets.contains(&head_offset) { |
| 389 | return Err(io::Error::new( |
| 390 | io::ErrorKind::InvalidInput, |
| 391 | format!("refusing to compress mutable segment {head_offset}"), |
| 392 | )); |
| 393 | } |
| 394 | let mut stats = <_>::default(); |
| 395 | for offset in offsets { |
| 396 | stats += repo.compress_segment(*offset)?; |
| 397 | } |
| 398 | Ok(stats) |
| 399 | } |
| 400 | |
| 401 | /// Remove all data from the log and reopen it. |
| 402 | /// |