You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2021/02/26 19:10:36 UTC

[couchdb] branch ebtree-lookup-collate-eq created (now 6f6db1e)

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a change to branch ebtree-lookup-collate-eq
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at 6f6db1e  use collate in lookup

This branch includes the following new commits:

     new 6f6db1e  use collate in lookup

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: use collate in lookup

Posted by rn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch ebtree-lookup-collate-eq
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 6f6db1ee27d8ac2879b4149378ea6b94dc5ddc42
Author: Robert Newson <rn...@apache.org>
AuthorDate: Fri Feb 26 19:05:05 2021 +0000

    use collate in lookup
---
 src/ebtree/src/ebtree.erl | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/ebtree/src/ebtree.erl b/src/ebtree/src/ebtree.erl
index 1a65c9a..1aa1494 100644
--- a/src/ebtree/src/ebtree.erl
+++ b/src/ebtree/src/ebtree.erl
@@ -132,13 +132,13 @@ max() ->
     {Key :: term(), Value :: term()} | false.
 lookup(Db, #tree{} = Tree, Key) ->
     Fun = fun
-        ({visit, K, V}, _Acc) when K =:= Key ->
-            {stop, {K, V}};
-        ({visit, K, _V}, Acc) ->
-            case collate(Tree, K, Key, [gt]) of
-                true ->
+        ({visit, K, V}, Acc) ->
+            case {collate(Tree, K, Key, [eq]), collate(Tree, K, Key, [gt])} of
+                {true, _} ->
+                    {stop, {K, V}};
+                {false, true} ->
                     {stop, Acc};
-                false ->
+                {false, false} ->
                     {ok, Acc}
             end;
         ({traverse, F, L, _R}, Acc) ->