Module riak_pipe_builder

The builder starts and monitors the fitting processes.

Behaviours: gen_fsm.

Description

The builder starts and monitors the fitting processes.

This startup process is how each fitting learns about the fitting that follows it. The builder is also the process that the client asks to find the head fitting.

Data Types

state()

abstract datatype: state()

Function Index

code_change/4Unused.
destroy/1Shutdown the pipeline built by this builder.
fitting_pids/1Get the list of pids for fittings that this builder started.
handle_event/3Unused.
handle_info/3The only non-gen_fsm message this process expects are `DOWN'' messages from monitoring the fittings it has started.
handle_sync_event/4The only sync event recognized in all states is fittings, which retrieves a count of fittings waiting to be started, and pids for fittings already started.
init/1Initialize the builder fsm (gen_fsm callback).
pipeline/1Get the #pipe{} record describing the pipeline created by this builder.
start_link/2Start a builder to setup the pipeline described by Spec.
terminate/3Terminate any fittings that are still alive.
wait_pipeline_shutdown/2All fittings have been started, and the builder is just monitoring the pipeline (and replying to clients looking for the head fitting).
wait_pipeline_shutdown/3A client is asking for the fittings.

Function Details

code_change/4

code_change(OldVsn::term(), StateName::atom(), State::state(), Extra::term()) -> {ok, atom(), state()}

Unused.

destroy/1

destroy(BuilderPid::pid()) -> ok

Shutdown the pipeline built by this builder.

fitting_pids/1

fitting_pids(Builder::pid()) -> {ok, FittingPids::[pid()]} | gone

Get the list of pids for fittings that this builder started. If the builder terminated before this call was made, the function returns the atom gone.

handle_event/3

handle_event(Event::term(), StateName::atom(), State::state()) -> {next_state, atom(), state()}

Unused.

handle_info/3

handle_info(Info::{'DOWN', reference(), process, pid(), term()}, StateName::atom(), State::state()) -> {next_state, atom(), state()} | {stop, term(), state()}

The only non-gen_fsm message this process expects are `DOWN'' messages from monitoring the fittings it has started. When normal `DOWN'' messages have been received from all monitored fittings, this gen_fsm stops with reason normal. If an error `DOWN'' message is received for any fitting, this process exits immediately, with an error reason.

handle_sync_event/4

handle_sync_event(Event::fittings, From::term(), StateName::atom(), State::state()) -> {reply, FittingPids::[pid()], StateName::atom(), state()}

The only sync event recognized in all states is fittings, which retrieves a count of fittings waiting to be started, and pids for fittings already started.

init/1

init(X1::[[riak_pipe:fitting_spec()] | riak_pipe:exec_opts()]) -> {ok, wait_pipeline_shutdown, state()}

Initialize the builder fsm (gen_fsm callback).

pipeline/1

pipeline(BuilderPid::pid()) -> {ok, #pipe{builder = undefined | pid(), fittings = undefined | [{Name::term(), #fitting{pid = undefined | pid(), ref = undefined | reference(), chashfun = undefined | riak_pipe_vnode:chashfun(), nval = undefined | riak_pipe_vnode:nval()}}], sink = undefined | #fitting{pid = undefined | pid(), ref = undefined | reference(), chashfun = undefined | riak_pipe_vnode:chashfun(), nval = undefined | riak_pipe_vnode:nval()}}} | gone

Get the #pipe{} record describing the pipeline created by this builder. This function will block until the builder has finished building the pipeline.

start_link/2

start_link(Spec::[riak_pipe:fitting_spec()], Options::riak_pipe:exec_opts()) -> {ok, pid(), reference()} | ignore | {error, term()}

Start a builder to setup the pipeline described by Spec.

terminate/3

terminate(Reason::term(), StateName::atom(), State::state()) -> ok

Terminate any fittings that are still alive.

wait_pipeline_shutdown/2

wait_pipeline_shutdown(Event::term(), State::state()) -> {next_state, wait_pipeline_shutdown, state()}

All fittings have been started, and the builder is just monitoring the pipeline (and replying to clients looking for the head fitting).

wait_pipeline_shutdown/3

wait_pipeline_shutdown(X1::pipeline | destroy, From::term(), State::state()) -> {reply, {ok, #pipe{builder = undefined | pid(), fittings = undefined | [{Name::term(), #fitting{pid = undefined | pid(), ref = undefined | reference(), chashfun = undefined | riak_pipe_vnode:chashfun(), nval = undefined | riak_pipe_vnode:nval()}}], sink = undefined | #fitting{pid = undefined | pid(), ref = undefined | reference(), chashfun = undefined | riak_pipe_vnode:chashfun(), nval = undefined | riak_pipe_vnode:nval()}}}, wait_pipeline_shutdown, state()} | {stop, normal, ok, state()}

A client is asking for the fittings. Respond.


Generated by EDoc, Aug 5 2012, 06:59:40.