Skip to content
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

Merged
merged 13 commits into from
Aug 18, 2023
Merged

merkledb -- use Maybe for start bounds #1872

merged 13 commits into from
Aug 18, 2023

Conversation

danlaine
Copy link

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 to maybe.Maybe[[]byte] for start bounds.

How this was tested

Update existing UT

@danlaine danlaine marked this pull request as ready for review August 17, 2023 16:25
x/sync/workheap.go Outdated Show resolved Hide resolved
heap.Fix(&wh.innerHeap, afterItem.heapIndex)
mergedAfter = afterItem
if item.localRootID == afterItem.workItem.localRootID {
if maybe.Equal(item.end, afterItem.workItem.start, bytes.Equal) {
Copy link
Contributor

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?

Copy link
Author

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this used anywhere?

Copy link
Author

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),

@danlaine danlaine merged commit 2bd58d1 into dev Aug 18, 2023
16 checks passed
@danlaine danlaine deleted the maybe-start-bounds branch August 18, 2023 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants