voldemort.server.protocol.vold
Class VoldemortNativeRequestHandler

java.lang.Object
  extended by voldemort.server.protocol.AbstractRequestHandler
      extended by voldemort.server.protocol.vold.VoldemortNativeRequestHandler
All Implemented Interfaces:
RequestHandler

public class VoldemortNativeRequestHandler
extends AbstractRequestHandler
implements RequestHandler

Server-side request handler for voldemort native client protocol


Constructor Summary
VoldemortNativeRequestHandler(ErrorCodeMapper errorMapper, StoreRepository repository, int protocolVersion)
           
 
Method Summary
 StreamRequestHandler handleRequest(java.io.DataInputStream inputStream, java.io.DataOutputStream outputStream)
          Handles the request as determined by the protocol and command provided as input.
 boolean isCompleteRequest(java.nio.ByteBuffer buffer)
          This is pretty ugly.
 
Methods inherited from class voldemort.server.protocol.AbstractRequestHandler
getErrorMapper, getStore, getStoreRepository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VoldemortNativeRequestHandler

public VoldemortNativeRequestHandler(ErrorCodeMapper errorMapper,
                                     StoreRepository repository,
                                     int protocolVersion)
Method Detail

handleRequest

public StreamRequestHandler handleRequest(java.io.DataInputStream inputStream,
                                          java.io.DataOutputStream outputStream)
                                   throws java.io.IOException
Description copied from interface: RequestHandler
Handles the request as determined by the protocol and command provided as input.

Specified by:
handleRequest in interface RequestHandler
Returns:
StreamRequestHandler if this is the beginning of a streaming request, null if self-contained
Throws:
java.io.IOException

isCompleteRequest

public boolean isCompleteRequest(java.nio.ByteBuffer buffer)
This is pretty ugly. We end up mimicking the request logic here, so this needs to stay in sync with handleRequest.

Specified by:
isCompleteRequest in interface RequestHandler
Parameters:
buffer - Buffer to check; the buffer is reset to position 0 before calling this method and the caller must reset it after the call returns
Returns:
True if the buffer holds a complete request, false otherwise


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