voldemort.server.protocol.admin
Class UpdatePartitionEntriesStreamRequestHandler

java.lang.Object
  extended by voldemort.server.protocol.admin.UpdatePartitionEntriesStreamRequestHandler
All Implemented Interfaces:
StreamRequestHandler
Direct Known Subclasses:
TimeBasedUpdatePartitionEntriesStreamRequestHandler

public class UpdatePartitionEntriesStreamRequestHandler
extends java.lang.Object
implements StreamRequestHandler

UpdatePartitionEntriesStreamRequestHandler implements the streaming logic for updating partition entries. This is the base class, which abstracts network IO to get an entry off the wire, and provides a hook processEntry(ByteArray, Versioned) to implement custom logic (if needed) to manage how the entry will be written to storage. The default implementation of processEntry(..) simply issues a storage engine put.


Nested Class Summary
 
Nested classes/interfaces inherited from interface voldemort.server.protocol.StreamRequestHandler
StreamRequestHandler.StreamRequestDirection, StreamRequestHandler.StreamRequestHandlerState
 
Field Summary
protected  int counter
           
protected  ErrorCodeMapper errorCodeMapper
           
protected  VoldemortFilter filter
           
protected  java.util.concurrent.atomic.AtomicBoolean isBatchWriteOff
           
protected  org.apache.log4j.Logger logger
           
protected  VAdminProto.UpdatePartitionEntriesRequest request
           
protected  VAdminProto.UpdatePartitionEntriesResponse.Builder responseBuilder
           
protected  long startTime
           
protected  StorageEngine<ByteArray,byte[],byte[]> storageEngine
           
protected  StreamingStats streamStats
           
protected  EventThrottler throttler
           
 
Fields inherited from interface voldemort.server.protocol.StreamRequestHandler
STAT_RECORDS_INTERVAL
 
Constructor Summary
UpdatePartitionEntriesStreamRequestHandler(VAdminProto.UpdatePartitionEntriesRequest request, ErrorCodeMapper errorCodeMapper, VoldemortConfig voldemortConfig, StorageEngine<ByteArray,byte[],byte[]> storageEngine, StoreRepository storeRepository, NetworkClassLoader networkClassLoader)
           
 
Method Summary
 void close(java.io.DataOutputStream outputStream)
           
protected  void finalize()
           
 StreamRequestHandler.StreamRequestDirection getDirection()
           
protected  java.lang.String getHandlerName()
           
 void handleError(java.io.DataOutputStream outputStream, VoldemortException e)
           
 StreamRequestHandler.StreamRequestHandlerState handleRequest(java.io.DataInputStream inputStream, java.io.DataOutputStream outputStream)
          Handles a "segment" of a streaming request.
protected  void processEntry(ByteArray key, Versioned<byte[]> value)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected VAdminProto.UpdatePartitionEntriesRequest request

responseBuilder

protected final VAdminProto.UpdatePartitionEntriesResponse.Builder responseBuilder

errorCodeMapper

protected final ErrorCodeMapper errorCodeMapper

throttler

protected final EventThrottler throttler

filter

protected final VoldemortFilter filter

storageEngine

protected final StorageEngine<ByteArray,byte[],byte[]> storageEngine

counter

protected int counter

startTime

protected final long startTime

streamStats

protected final StreamingStats streamStats

logger

protected final org.apache.log4j.Logger logger

isBatchWriteOff

protected java.util.concurrent.atomic.AtomicBoolean isBatchWriteOff
Constructor Detail

UpdatePartitionEntriesStreamRequestHandler

public UpdatePartitionEntriesStreamRequestHandler(VAdminProto.UpdatePartitionEntriesRequest request,
                                                  ErrorCodeMapper errorCodeMapper,
                                                  VoldemortConfig voldemortConfig,
                                                  StorageEngine<ByteArray,byte[],byte[]> storageEngine,
                                                  StoreRepository storeRepository,
                                                  NetworkClassLoader networkClassLoader)
Method Detail

handleRequest

public StreamRequestHandler.StreamRequestHandlerState handleRequest(java.io.DataInputStream inputStream,
                                                                    java.io.DataOutputStream outputStream)
                                                             throws java.io.IOException
Description copied from interface: StreamRequestHandler
Handles a "segment" of a streaming request.

Specified by:
handleRequest in interface StreamRequestHandler
Returns:
StreamRequestHandler.StreamRequestHandlerState
Throws:
java.io.IOException

getDirection

public StreamRequestHandler.StreamRequestDirection getDirection()
Specified by:
getDirection in interface StreamRequestHandler

close

public void close(java.io.DataOutputStream outputStream)
           throws java.io.IOException
Specified by:
close in interface StreamRequestHandler
Throws:
java.io.IOException

handleError

public void handleError(java.io.DataOutputStream outputStream,
                        VoldemortException e)
                 throws java.io.IOException
Specified by:
handleError in interface StreamRequestHandler
Throws:
java.io.IOException

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

processEntry

protected void processEntry(ByteArray key,
                            Versioned<byte[]> value)
                     throws java.io.IOException
Throws:
java.io.IOException

getHandlerName

protected java.lang.String getHandlerName()


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