Use official sext instead of copy
This commit is contained in:
parent
6c9f5b565f
commit
3fccd1cd4f
@ -20,7 +20,7 @@ tables you want to be in RocksDB.
|
|||||||
|
|
||||||
RocksDB tables support efficient selects on *prefix keys*.
|
RocksDB tables support efficient selects on *prefix keys*.
|
||||||
|
|
||||||
The backend uses the `mnesia_rocksdb_sext` module (see
|
The backend uses the `sext` module (see
|
||||||
https://github.com/uwiger/sext) for mapping between Erlang terms and the
|
https://github.com/uwiger/sext) for mapping between Erlang terms and the
|
||||||
binary data stored in the tables. This provides two useful properties:
|
binary data stored in the tables. This provides two useful properties:
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
%% -*- erlang -*-
|
%% -*- erlang -*-
|
||||||
{deps,
|
{deps,
|
||||||
[
|
[
|
||||||
|
{sext, "1.4.1"},
|
||||||
{rocksdb,"0.14.0"}
|
{rocksdb,"0.14.0"}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
{"1.1.0",
|
{"1.1.0",
|
||||||
[{<<"rocksdb">>,{pkg,<<"rocksdb">>,<<"0.14.0">>},0}]}.
|
[{<<"rocksdb">>,{pkg,<<"rocksdb">>,<<"0.14.0">>},0},
|
||||||
|
{<<"sext">>,{pkg,<<"sext">>,<<"1.4.1">>},0}]}.
|
||||||
[
|
[
|
||||||
{pkg_hash,[
|
{pkg_hash,[
|
||||||
{<<"rocksdb">>, <<"C92B48703D4812C8BC571E0FBB7681F0899F35C4E4330F1CF646D79357A6AFE4">>}]}
|
{<<"rocksdb">>, <<"C92B48703D4812C8BC571E0FBB7681F0899F35C4E4330F1CF646D79357A6AFE4">>},
|
||||||
|
{<<"sext">>, <<"14559B219FAF11F9EBA7A350DFFC69C966C668439C54947A42D67167002798C4">>}]}
|
||||||
].
|
].
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
{description, "RocksDB backend plugin for Mnesia"},
|
{description, "RocksDB backend plugin for Mnesia"},
|
||||||
{vsn, "1.0"},
|
{vsn, "1.0"},
|
||||||
{modules, [mnesia_rocksdb, mnesia_rocksdb_app,
|
{modules, [mnesia_rocksdb, mnesia_rocksdb_app,
|
||||||
mnesia_rocksdb_params, mnesia_rocksdb_sext,
|
mnesia_rocksdb_params, mnesia_rocksdb_sup,
|
||||||
mnesia_rocksdb_sup, mnesia_rocksdb_tuning]},
|
mnesia_rocksdb_tuning]},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{mod, {mnesia_rocksdb_app, []}},
|
{mod, {mnesia_rocksdb_app, []}},
|
||||||
{env, []},
|
{env, []},
|
||||||
|
@ -1538,7 +1538,7 @@ keypat([{HeadPat,Gs,_}|_], KeyPos) when is_tuple(HeadPat) ->
|
|||||||
KP = element(KeyPos, HeadPat),
|
KP = element(KeyPos, HeadPat),
|
||||||
KeyVars = extract_vars(KP),
|
KeyVars = extract_vars(KP),
|
||||||
Guards = relevant_guards(Gs, KeyVars),
|
Guards = relevant_guards(Gs, KeyVars),
|
||||||
Pfx = mnesia_rocksdb_sext:prefix(KP),
|
Pfx = sext:prefix(KP),
|
||||||
{Pfx, [{KP, Guards, [true]}]};
|
{Pfx, [{KP, Guards, [true]}]};
|
||||||
keypat(_, _) ->
|
keypat(_, _) ->
|
||||||
{<<>>, [{'_',[],[true]}]}.
|
{<<>>, [{'_',[],[true]}]}.
|
||||||
@ -1574,10 +1574,10 @@ keypos(Tab) when is_atom(Tab) ->
|
|||||||
2.
|
2.
|
||||||
|
|
||||||
encode_key(Key) ->
|
encode_key(Key) ->
|
||||||
mnesia_rocksdb_sext:encode(Key).
|
sext:encode(Key).
|
||||||
|
|
||||||
decode_key(CodedKey) ->
|
decode_key(CodedKey) ->
|
||||||
case mnesia_rocksdb_sext:partial_decode(CodedKey) of
|
case sext:partial_decode(CodedKey) of
|
||||||
{full, Result, _} ->
|
{full, Result, _} ->
|
||||||
Result;
|
Result;
|
||||||
_ ->
|
_ ->
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user