Skip to content

Commit

Permalink
Cleanup merge logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tarkah committed Sep 18, 2024
1 parent fcf4516 commit f6028d1
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions data/src/history/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,12 @@ pub struct Metadata {
impl Metadata {
pub fn merge(self, other: Self) -> Self {
Self {
read_marker: self
.read_marker
.zip(other.read_marker)
.map(|(a, b)| a.max(b))
.or(self.read_marker)
.or(other.read_marker),
read_marker: self.read_marker.max(other.read_marker),
}
}

pub fn update_read_marker(&mut self, read_marker: ReadMarker) {
self.read_marker = Some(
self.read_marker
.map_or(read_marker, |marker| marker.max(read_marker)),
);
self.read_marker = self.read_marker.max(Some(read_marker));
}

pub fn updated(self, messages: &[Message]) -> Self {
Expand Down

0 comments on commit f6028d1

Please sign in to comment.