hanoidb/src/lsm_btree.hrl
Kresten Krab Thorup f0def8231b Introduce btree_range record for range queries
This allows specifying ranges with from/to
being inclusive or not, and providing a result
limit (latter not implemented yet).

This change just makes all current tests pass.
2012-01-23 00:51:31 +01:00

36 lines
1 KiB
Erlang

%% smallest levels are 32 entries
-define(TOP_LEVEL, 5).
-define(BTREE_SIZE(Level), (1 bsl (Level))).
-define(TOMBSTONE, 'deleted').
-define(KEY_IN_FROM_RANGE(Key,Range),
((Range#btree_range.from_inclusive andalso
(Range#btree_range.from_key =< Key))
orelse
(Range#btree_range.from_key < Key))).
-define(KEY_IN_TO_RANGE(Key,Range),
((Range#btree_range.to_key == undefined)
orelse
((Range#btree_range.to_inclusive andalso
(Key =< Range#btree_range.to_key))
orelse
(Key < Range#btree_range.to_key)))).
-define(KEY_IN_RANGE(Key,Range),
((Range#btree_range.from_inclusive andalso
(Range#btree_range.from_key =< Key))
orelse
(Range#btree_range.from_key < Key))
andalso
((Range#btree_range.to_key == undefined)
orelse
((Range#btree_range.to_inclusive andalso
(Key =< Range#btree_range.to_key))
orelse
(Key < Range#btree_range.to_key)))).