Skip to content

Commit

Permalink
added CanBeAfter(offset) method
Browse files Browse the repository at this point in the history
  • Loading branch information
sn0wyQ committed Jan 25, 2023
1 parent cdf40aa commit 61bcb06
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/proximaclient/model_offset.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func ZeroOffset() *Offset {
return NewOffset("", 0, ZeroTimestamp())
}

func (offset *Offset) CanBeAfter(another Offset) bool {
return offset.Height > another.Height && offset.Timestamp.GreaterThan(another.Timestamp)
}

func (offset *Offset) CanSucceed(another Offset) bool {
return offset.Height-1 == another.Height && offset.Timestamp.GreaterThan(another.Timestamp)
}
Expand Down

0 comments on commit 61bcb06

Please sign in to comment.