Skip to content

Commit

Permalink
refactor: use FnOnce to avoid cloning writer paths
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-j97 committed Jun 9, 2024
1 parent dc4c9c6 commit 92f048d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl SegmentManifest {
}

/// Modifies the level manifest atomically.
pub(crate) fn atomic_swap<F: Fn(&mut HashMap<SegmentId, Arc<Segment>>)>(
pub(crate) fn atomic_swap<F: FnOnce(&mut HashMap<SegmentId, Arc<Segment>>)>(
&self,
f: F,
) -> crate::Result<()> {
Expand Down Expand Up @@ -188,7 +188,7 @@ impl SegmentManifest {
let writers = writer.finish()?;

self.atomic_swap(move |recipe| {
for writer in &writers {
for writer in writers {
if writer.item_count == 0 {
log::trace!(
"Writer at {:?} has written no data, deleting empty vLog segment file",
Expand All @@ -209,7 +209,7 @@ impl SegmentManifest {
segment_id,
Arc::new(Segment {
id: segment_id,
path: writer.path.clone(),
path: writer.path,
meta: Metadata {
item_count: writer.item_count,
compressed_bytes: writer.written_blob_bytes,
Expand Down

0 comments on commit 92f048d

Please sign in to comment.