Skip to content
Permalink
Browse files
Fix tuple mutation macros
This improves the consistency of the macro argument ordering and general
usage after having worked with it in the directory layer.
  • Loading branch information
davisp committed Feb 22, 2019
1 parent 1cb7d6b commit 2ef57339724f8bc60b8add6576e5962c4aa15df7
Showing 1 changed file with 8 additions and 5 deletions.
@@ -15,18 +15,21 @@


-define(ERLFDB_PACK(Tuple), erlfdb_tuple:pack(Tuple)).
-define(ERLFDB_PACK(Tuple, Prefix), erlfdb_tuple:pack(Tuple, Prefix)).
-define(ERLFDB_PACK(Prefix, Tuple), erlfdb_tuple:pack(Tuple, Prefix)).

-define(ERLFDB_RANGE(Prefix), erlfdb_tuple:range({}, Prefix)).
-define(ERLFDB_RANGE(Prefix, Term), erlfdb_tuple:range({Term}, Prefix)).
-define(ERLFDB_RANGE(Prefix),
erlfdb_subspace:range(erlfdb_subspace:create({}, Prefix))).
-define(ERLFDB_RANGE(Prefix, Term),
erlfdb_subspace:range(erlfdb_subspace:create({Term}, Prefix))).

-define(ERLFDB_EXTEND(Prefix, Term), erlfdb_tuple:pack({Term}, Prefix)).

-define(ERLFDB_EXTRACT(Prefix, Packed), begin
-define(ERLFDB_EXTRACT(Prefix, Packed), (fun() ->
__PrefixLen = size(Prefix),
<<Prefix:__PrefixLen/binary, __Tail/binary>> = Packed,
erlfdb_tuple:unpack(__Tail)
end).
end)()).




0 comments on commit 2ef5733

Please sign in to comment.