-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merkledb
-- use Maybe
for start bounds
#1872
Conversation
x/sync/workheap.go
Outdated
heap.Fix(&wh.innerHeap, afterItem.heapIndex) | ||
mergedAfter = afterItem | ||
if item.localRootID == afterItem.workItem.localRootID { | ||
if maybe.Equal(item.end, afterItem.workItem.start, bytes.Equal) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reason to split the if?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-added &&
and removed second if
@@ -42,6 +47,13 @@ func (m Maybe[T]) Value() T { | |||
return m.value | |||
} | |||
|
|||
func (m Maybe[T]) String() string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes in manager.go
:
zap.Stringer("start", work.start),
zap.Stringer("end", largestHandledKey),
Why this should be merged
We already use
Maybe
for end bounds so we should use them for start bounds for xonsistency.How this works
Change
[]byte
tomaybe.Maybe[[]byte]
for start bounds.How this was tested
Update existing UT