diff options
author | Gabor Pali <gabor.pali@ibm.com> | 2023-02-13 22:57:25 +0100 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2023-02-14 10:14:33 -0500 |
commit | 1c90b504a9439a6c7c2a8754b03955b17780d6a8 (patch) | |
tree | 17bb6dae77349a1d0c63093005d30f6f1d559486 /src/mango | |
parent | b08dc7ac77dd3ea53cf1b8b92571387478e5b143 (diff) | |
download | couchdb-1c90b504a9439a6c7c2a8754b03955b17780d6a8.tar.gz |
mango: Add type specification for the JSON index selection
Diffstat (limited to 'src/mango')
-rw-r--r-- | src/mango/src/mango_cursor_view.erl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mango/src/mango_cursor_view.erl b/src/mango/src/mango_cursor_view.erl index 3f67f667b..883f2e448 100644 --- a/src/mango/src/mango_cursor_view.erl +++ b/src/mango/src/mango_cursor_view.erl @@ -31,6 +31,7 @@ -include_lib("fabric/include/fabric.hrl"). -include("mango_cursor.hrl"). +-include("mango_idx.hrl"). -include("mango_idx_view.hrl"). -define(HEARTBEAT_INTERVAL_IN_USEC, 4000000). @@ -230,6 +231,11 @@ composite_prefix([Col | Rest], Ranges) -> % In the future we can look into doing a cached parallel % reduce view read on each index with the ranges to find % the one that has the fewest number of rows or something. +-type range() :: {binary(), any(), binary(), any()} | empty. + +-spec choose_best_index(IndexRanges) -> Selection when + IndexRanges :: nonempty_list({#idx{}, [range()], integer()}), + Selection :: {#idx{}, [range()]}. choose_best_index(IndexRanges) -> Cmp = fun({IdxA, _PrefixA, PrefixDifferenceA}, {IdxB, _PrefixB, PrefixDifferenceB}) -> case PrefixDifferenceA - PrefixDifferenceB of |