Module elb

Basic Load Balancer

Create workers and Round Robin messages to them.

Authors: Pierre Defebvre.

Description

Basic Load Balancer

Create workers and Round Robin messages to them

Data Types

server_ref()

server_ref() = atom() | {atom(), atom()} | {global, atom()} | {via, atom(), atom()} | pid()

Function Index

broadcast/2 Broadcast message workers.
call/2 Send message to worker {Message, From} with expectation for reponse from Worker.
cast/2 Send async message to worker.
code_change/3
get_workers/1 Return list of workers.
handle_call/3
handle_cast/2
handle_info/2
init/1
reply/2 Abstract gen_server:reply
start/1
start_link/1
stop/1
subscribe/1 Add self() to worker pool.
subscribe/2 Add pid() to worker pool.
terminate/2
unsubscribe/1 Remove self() from worker pool.
unsubscribe/2 Remove pid() from worker pool.

Function Details

broadcast/2

broadcast(Server::server_ref(), Message::any()) -> ok

Broadcast message workers

call/2

call(Server::server_ref(), Message::any()) -> any()

Send message to worker {Message, From} with expectation for reponse from Worker. Worker should reply via elb:reply(From, Reply)

cast/2

cast(Server::server_ref(), Message::any()) -> ok

Send async message to worker

code_change/3

code_change(OldVsn, State, Extra) -> any()

get_workers/1

get_workers(Server::server_ref()) -> {ok, [pid(), ...]}

Return list of workers

handle_call/3

handle_call(Msg, From, State) -> any()

handle_cast/2

handle_cast(Msg, State) -> any()

handle_info/2

handle_info(Msg, State) -> any()

init/1

init(Args) -> any()

reply/2

reply(From::{pid(), reference()}, Message::any()) -> any()

Abstract gen_server:reply

start/1

start(Args::list()) -> {ok, pid()} | ignore | {error, any()}

start_link/1

start_link(Args::list()) -> {ok, pid()} | ignore | {error, any()}

stop/1

stop(Server::server_ref()) -> ok

subscribe/1

subscribe(Server::server_ref()) -> ok

Add self() to worker pool

subscribe/2

subscribe(Server::server_ref(), PID::pid()) -> ok

Add pid() to worker pool

terminate/2

terminate(Reason, State) -> any()

unsubscribe/1

unsubscribe(Server::server_ref()) -> ok

Remove self() from worker pool

unsubscribe/2

unsubscribe(Server::server_ref(), PID::pid()) -> ok

Remove pid() from worker pool


Generated by EDoc, Oct 18 2017, 16:19:36.