Automatically load all WiredTiger extension shared libraries found in the priv dir at load time.

This commit is contained in:
Gregory Burd 2013-03-28 10:45:24 -04:00
parent 3ef48e0ac0
commit 1595ce3096

View file

@ -98,10 +98,16 @@ init() ->
-spec connection_open(string(), config()) -> {ok, connection()} | {error, term()}. -spec connection_open(string(), config()) -> {ok, connection()} | {error, term()}.
connection_open(HomeDir, Config) -> connection_open(HomeDir, Config) ->
PrivDir = wterl:priv_dir(), PrivDir = wterl:priv_dir(),
Bin = config_to_bin([{extensions, {ok, PrivFiles} = file:list_dir(PrivDir),
[filename:join(PrivDir, "libwiredtiger_snappy.so"), SoFiles =
filename:join(PrivDir, "libwiredtiger_bzip2.so")]}], lists:filter(fun(Elem) ->
[<<",">>, Config]), case re:run(Elem, "^libwiredtiger_.*\.so$") of
{match, _} -> true;
nomatch -> false
end
end, PrivFiles),
SoPaths = lists:map(fun(Elem) -> filename:join(PrivDir, Elem) end, SoFiles),
Bin = config_to_bin([{extensions, SoPaths}], [<<",">>, Config]),
conn_open(HomeDir, Bin). conn_open(HomeDir, Bin).
-spec conn_open(string(), config()) -> {ok, connection()} | {error, term()}. -spec conn_open(string(), config()) -> {ok, connection()} | {error, term()}.