Fix ydn-db#90: traverse() call func parameter even if tree is empty. #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In traverse, and reverse Traverse methods, on an empty tree, or if there is no node with value >= to the start value, the func parameter is not called.
In the scan method in the same context, func method is called.
In ydn.db.core.req.SimpleCursor, if the func parameter of buffer is not called the onSuccess callback is never called and the result state is never set to 'ready'.
This fix call func function with a null parameter if tree is empty or if there is no node with value >= to the start value.
Calling func with null parameter seems to be the way to go since the last line of traverse is already "func(null); // let know, no more traversal" So calling func with a null parameter should already be supported and means that there is no result to the request.