voldemort.store.routed
Class Pipeline

java.lang.Object
  extended by voldemort.store.routed.Pipeline

public class Pipeline
extends java.lang.Object

A Pipeline is the main conduit through which an Action is run. An Action is executed in response to the Pipeline receiving an event. The majority of the events are self-initiated from within the Pipeline itself. The only case thus-far where external entities create events are in response to asynchronous responses from servers. A Response instance is created on completion of an asynchronous request and is fed back into the Pipeline where an appropriate 'response handler' action is executed.

A Pipeline instance is created per-request inside RoutedStore. This is due to the fact that it includes internal state, specific to each operation request (get, getAll, getVersions, put, and delete) invocation.


Nested Class Summary
static class Pipeline.Event
           
static class Pipeline.Operation
           
 
Constructor Summary
Pipeline(Pipeline.Operation operation, long timeout, java.util.concurrent.TimeUnit unit)
           
 
Method Summary
 void abort()
          Pipeline can't proceed further.
 void addEvent(Pipeline.Event event)
          Add an event to the queue.
 void addEventAction(Pipeline.Event event, Action action)
          Assigns the event to be handled by the given action.
 void execute()
          Process events in the order as they were received.
 Pipeline.Operation getOperation()
           
 boolean isFinished()
           
 boolean isHintedHandoffEnabled()
           
 void setEnableHintedHandoff(boolean enableHintedHandoff)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pipeline

public Pipeline(Pipeline.Operation operation,
                long timeout,
                java.util.concurrent.TimeUnit unit)
Parameters:
operation -
timeout - Timeout
unit - Unit of timeout
Method Detail

getOperation

public Pipeline.Operation getOperation()

addEventAction

public void addEventAction(Pipeline.Event event,
                           Action action)
Assigns the event to be handled by the given action. When a given event is received, it is expected that there is an action to handle it.

Parameters:
event - Event
action - Action to invoke upon receipt of that event

abort

public void abort()
Pipeline can't proceed further. If hinted handoff is enabled go to go to a state where it can be performed, otherwise go straight to error state.


addEvent

public void addEvent(Pipeline.Event event)
Add an event to the queue. It will be processed in the order received.

Parameters:
event - Event

isHintedHandoffEnabled

public boolean isHintedHandoffEnabled()

setEnableHintedHandoff

public void setEnableHintedHandoff(boolean enableHintedHandoff)

isFinished

public boolean isFinished()

execute

public void execute()
Process events in the order as they were received.

The overall time to process the events must be within the bounds of the timeout or an InsufficientOperationalNodesException will be thrown.



Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu