Permalink
Browse files

Add riak_pipe vnode worker template

  • Loading branch information...
1 parent 0f1b97d commit 3fbac79a1a22f2ce971a9aea2d9432ed25a6528b @mbbx6spp committed Mar 3, 2013
Showing with 74 additions and 0 deletions.
  1. +66 −0 riak_pipe_vnode_worker.erl
  2. +8 −0 riak_pipe_vnode_worker.template
View
66 riak_pipe_vnode_worker.erl
@@ -0,0 +1,66 @@
+%%% -*- mode: erlang -*-
+%%% vim: set filetype=erlang tabstop=2 foldmarker=%%%',%%%. foldmethod=marker:
+%%%' HEADER
+%%% @copyright {{copyright_year}} {{author_name}} <{{author_email}}>
+%%% @license {{license}}
+%%% @doc
+%%% {{description}}
+%%% @end
+-module({{name}}_vnode_worker).
+
+-behavior(riak_pipe_vnode_worker).
+
+-export([
+ init/2,
+ process/3,
+ done/1
+]).
+
+-include("riak_pipe.hrl").
+-include("riak_pipe_log.hrl").
+
+-record(state,
+ { partition :: riak_pipe_vnode:partition()
+ , fitting_details :: riak_pipe_fitting:details()
+ }
+).
+-opaque state() :: #state{}.
+
+% TODO: Add macros or records here if pertinent
+
+
+%%%.
+%%%' PUBLIC API
+
+%% @doc Initialization stores the partition and fitting details
+%% in the module's state record so it can send outputs from
+%% {@link process/3}.
+-spec init(Partition, FittingDetails) -> {ok, state()}
+ when
+ Partition :: riak_pipe_vnode:partition(),
+ FittingDetails :: riak_pipe_vnode:details().
+init(_Partition, _FittingDetails) ->
+ % TODO: Implement
+ not_implemented.
+
+%% @doc
+-spec process(Input, Last, State) -> {ok, NewState}
+ when
+ Input :: any(),
+ Last :: any(),
+ State :: state(),
+ NewState :: state().
+process(_Input, _Last, _State) ->
+ % TODO: Implement
+ not_implemented.
+
+-spec done(State :: state()) -> ok.
+done(_State) ->
+ % TODO: Implement
+ not_implemented.
+
+%%%.
+%%%' PRIVATE FUNCTIONS
+% TODO: Add private helper functions here.
+
+%%%.
View
8 riak_pipe_vnode_worker.template
@@ -0,0 +1,8 @@
+{variables, [
+ {name, "mymodule"},
+ {copyright_year, "2013"},
+ {author_name, "Susan Potter"},
+ {author_email,"me@susanpotter.net"},
+ {description, "A riak_pipe vnode worker callback module."}
+]}.
+{template, "riak_pipe_vnode_worker.erl", "{{name}}_vnode_worker.erl"}.

0 comments on commit 3fbac79

Please sign in to comment.