Support for elixir view in BarrelDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Relevent part | |
find_erts_dir | |
export ROOTDIR="$RELEASE_ROOT_DIR" | |
export BINDIR="$ERTS_DIR/bin" | |
export EMU="beam" | |
export PROGNAME="erl" | |
export ERL_LIBS="/usr/local/lib/elixir/lib" | |
export LD_LIBRARY_PATH="$ERTS_DIR/lib:$LD_LIBRARY_PATH" | |
ERTS_LIB_DIR="$ERTS_DIR/../lib" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Relevent part | |
makefun(State, Source) -> | |
application:start(elixir), | |
Converted = 'Elixir.CouchElixirUtils':to_erlang(Source), | |
Sig = couch_util:md5(Converted), | |
BindFuns = bindings(State, Sig), | |
{Sig, makefun(State, Converted, BindFuns)}. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule CouchElixirUtils do | |
def to_erlang(source) do | |
eval_string(source) | |
end | |
def eval_string(string) do | |
string | |
|> Code.string_to_quoted! | |
|> :elixir.quoted_to_erl(:elixir.env_for_eval([])) | |
|> Tuple.to_list | |
|> Enum.at(0) | |
|> :erl_pp.expr | |
|> List.flatten | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[query_servers] | |
erlang = {couch_native_process, start_link, []} | |
elixir = {couch_elixir_process, start_link, []} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment