Created
December 26, 2011 10:18
-
-
Save essen/1520860 to your computer and use it in GitHub Desktop.
goldrush API
This file contains hidden or 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
-module(goldrush). | |
application:start(goldrush) | |
%% Start daemons under goldrush supervision tree. | |
start_daemon(Name, Module, Options) | |
stop_daemon(Name) | |
%% Daemons started this way must define: | |
start_link(Name, Options) | |
%% Send an event (of the form {DaemonName, Message}). | |
event(Message) | |
%% Routes are just funs since it allows greater configurability. | |
add_route(Name, Fun) | |
replace_route(Name, Fun) | |
enable_route(Name) | |
disable_route(Name) | |
rm_route(Name) | |
%% This is how route funs are supposed to look like. | |
route_fun([{daemon_name, Message}|Tail]) -> | |
ok %% If we emptied the buffer. | |
{ok, Buffer} %% If we bufferized a few things. | |
%% We can of course have a few existing routes by default. | |
fun goldrush_folsom:route/1 | |
fun goldrush_lager:route/1 | |
fun goldrush_saloon:route/1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment