Module riak_ensemble_router

The primary purpose of this module is to route requests to ensemble leaders given ensemble names, even if the requests are originating from nodes that are not part of the ensemble system: eg.

Behaviours: gen_server.

Description

The primary purpose of this module is to route requests to ensemble leaders given ensemble names, even if the requests are originating from nodes that are not part of the ensemble system: eg. a remote Erlang node using riak_ensemble_client. This router also addresses the issue that ensemble and peer names are arbitrary terms and not registered names, and therefore Erlang's built-in messaging cannot directly address ensemble peers.

This routing layer is handled by multiple instances of this module that run on each node in the ensemble cluster. A request is sent to a random router on a given node, which then looks up the ensemble leader using its local riak_ensemble_manager state, routing the request directly to a local pid (if the leader is local) or forwarding on to a router on the respective leading node.

The reason for running multiple router instances per node is to enable additional concurrency and not have a single router bottleneck traffic.

A secondary purpose of this module is to provide an isolated version of gen_fsm:send_sync_event that converts timeouts into error tuples rather than exit conditions, as well as discarding late/delayed messages. This isolation is provided by spawning an intermediary proxy process.

Function Index

code_change/3
handle_call/3
handle_cast/2
handle_info/2
init/1
start_link/1
terminate/2

Function Details

code_change/3

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

handle_call/3

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

handle_cast/2

handle_cast(Msg, State) -> any()

handle_info/2

handle_info(Info, State) -> any()

init/1

init(X1) -> any()

start_link/1

start_link(Name::atom()) -> ignore | {error, term()} | {ok, pid()}

terminate/2

terminate(Reason, State) -> any()


Generated by EDoc