Behaviours: riak_core_vnode.
chash() = chash:index()
chashfun() = {Module::atom(), Function::atom()} | chash() | follow | sink | fun((term()) -> chash())
1.0.x compatibility
nval() = pos_integer() | {Module::atom(), Function::atom()} | fun((term()) -> pos_integer())
1.0.x compatibility
partition() = non_neg_integer()
qerror() = worker_limit_reached | worker_startup_failed | timeout | forwarding | preflist_exhausted
qtimeout() = noblock | infinity
sender() = {sender_type(), reference(), pid()} | {server, undefined, undefined} | {fsm, undefined, pid()} | ignore
sender_type() = fsm | server | raw
abstract datatype: state()
delete/1 | Unused. |
encode_handoff_item/2 | Produce a binary representing the worker data to handoff. |
eoi/2 | Send end-of-inputs for a fitting to a vnode. |
handle_command/3 | Handle a vnode command. |
handle_coverage/4 | Coverage requests may be used to enqueue identical work on multiple vnodes. |
handle_exit/3 | Handle an 'EXIT' message from a worker process. |
handle_handoff_command/3 | Handle a handoff command. |
handle_handoff_data/2 | Accept handoff data from some other node. |
handle_info/2 | Handle a 'DOWN' message from a fitting process. |
handoff_cancelled/1 | Stop handing off before getting started. |
handoff_finished/2 | Note that handoff has completed. |
handoff_starting/2 | Be prepared to handoff. |
hash_for_partition/1 | Produce a hash value in the range handled by the given partition. |
init/1 | Initialize the vnode. |
is_empty/1 | Determine whether this vnode has any running workers. |
next_input/2 | Request the next input from the queue for the given fitting from a vnode. |
queue_work/2 | Equivalent to queue_work(Fitting, Input, infinity). |
queue_work/3 | Equivalent to queue_work(Fitting, Input, Timeout, []). |
queue_work/4 | Queue the given Input for processing by the Fitting . |
queue_work/5 | Queue the given Input for processing the the Fitting on
the vnode specified by Hash . |
reply_archive/3 | Send the result of archiving a worker to the vnode that owns that worker. |
start_vnode/1 | Start the vnode, if it isn't started already. |
status/1 | Get some information about the worker queues on this vnode. |
status/2 | Produces the same type of data as status/1 , but only
includes information for the fittings given. |
terminate/2 | Unused. |
Unused.
encode_handoff_item(Fitting::riak_pipe:fitting(), X2::{queue(), queue(), term()}) -> binary()
Produce a binary representing the worker data to handoff.
eoi(Pid::pid(), Fitting::riak_pipe:fitting()) -> ok
Send end-of-inputs for a fitting to a vnode. Note: this
should only be called by riak_pipe_fitting
processes. This
will cause the vnode to shutdown the worker, dispose of the
queue, and send a done
to the fitting, once the queue is
emptied.
handle_command(Cmd_enqueue::term(), Sender::sender(), State::state()) -> {reply, term(), state()} | {noreply, state()}
Handle a vnode command.
handle_coverage(Request::term(), FilterVNodes::term(), Sender::sender(), State::state()) -> {reply, ok, state()}
Coverage requests may be used to enqueue identical work on
multiple vnodes. Input
is delivered to the worker as
{cover, FilterVNodes, Input}
.
Handle an 'EXIT' message from a worker process.
If the worker died normally after receiving end-of-inputs and
emptying its queue, send done
to the fitting, and remove the
worker's entry in the vnodes list.
handle_handoff_command(Riak_core_fold_req_v1::term(), Sender::sender(), State::state()) -> {reply, term(), state()} | {noreply, state()} | {forward, state()}
Handle a handoff command.
Accept handoff data from some other node. Data
should be a
term_to_binary-ed #worker_handoff{}
record. See encode_handoff_item/2
.
Handle a 'DOWN' message from a fitting process. Kill the worker associated with that fitting and dispose of its queue.
Stop handing off before getting started.
Note that handoff has completed.
Be prepared to handoff.
hash_for_partition(I::partition()) -> chash()
Produce a hash value in the range handled by the given
partition. Used to support the follow
chashfun.
init(X1::[partition()]) -> {ok, state()}
Initialize the vnode. This function validates the limits set in the application environment, and starts the worker supervisor.
Two application environment variables matter to the vnode:worker_limit
worker_queue_limit
q_limit
specified in the
startup spec.
Determine whether this vnode has any running workers.
next_input(Pid::pid(), Fitting::riak_pipe:fitting()) -> ok
Request the next input from the queue for the given fitting from a vnode. Note: this should only be called by the worker process for that fitting-vnode pair. This will cause the vnode to send the next input to the worker process for this fitting.
queue_work(Fitting, Input) -> any()
Equivalent to queue_work(Fitting, Input, infinity).
queue_work(Fitting, Input, Timeout) -> any()
Equivalent to queue_work(Fitting, Input, Timeout, []).
queue_work(Fitting::riak_pipe:fitting(), Input::term(), Timeout::qtimeout(), UsedPreflist::riak_core_apl:preflist()) -> ok | {error, [qerror()]}
Queue the given Input
for processing by the Fitting
. This
function handles getting the input to the correct vnode by
evaluating the fitting's consistent-hashing function
(chashfun
) on the input.
queue_work(Fitting::riak_pipe:fitting(), Input::term(), Timeout::qtimeout(), UsedPreflist::riak_core_apl:preflist(), Hash::chash()) -> ok | {error, [qerror()]}
Queue the given Input
for processing the the Fitting
on
the vnode specified by Hash
. This version of the function
is used to support the follow
chashfun, by allowing a worker
to send the input directly to the vnode it works for.
Timeout
may be any of the following:
infinity
noblock
noblock
will wait as long as necessary for a response from
the vnode, but will direct the vnode not to block the request
if the queue is full.
reply_archive(Pid::pid(), Fitting::riak_pipe:fitting(), Archive::term()) -> ok
Send the result of archiving a worker to the vnode that owns that worker. Note: this should only be called by the worker being archived. This will cause the vnode to send that worker's queue and archive to its handoff partner when instructed to do so.
start_vnode(I::partition()) -> {ok, pid()}
Start the vnode, if it isn't started already.
status(Pid::pid()) -> {partition(), [[{atom(), term()}]]}
Get some information about the worker queues on this vnode.
The result is a tuple of the form {PartitionNumber,
[WorkerProplist]}
. Each WorkerProplist contains tagged
tuples, such as:
fitting
name
module
state
working
, waiting
, init
.
inputs_done
eoi
has been delivered for this fitting,
false otherwise.
queue_length
blocking_length
started
erlang:now/0
tuple, indicating the time that the
worker started.
processed
failures
work_time
idle_time
(now()-started)-work_time
.
status(Pid::pid(), Fittings::[#fitting{pid = undefined | pid(), ref = undefined | reference(), chashfun = undefined | riak_pipe_vnode:chashfun(), nval = undefined | riak_pipe_vnode:nval()}] | all) -> {partition(), [[{atom(), term()}]]}
Produces the same type of data as status/1
, but only
includes information for the fittings given.
terminate(Reason::term(), State::state()) -> ok
Unused.
Generated by EDoc, Nov 21 2012, 15:51:29.