OperationImpl Class Reference

Inherits net::spy::memcached::protocol::BaseOperationImpl.

Inherited by ConcatenationOperationImpl, DeleteOperationImpl, FlushOperationImpl, GetOperationImpl, MultiGetOperationImpl, MutatorOperationImpl, NoopOperationImpl, StoreOperationImpl, and VersionOperationImpl.

Collaboration diagram for OperationImpl:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void readFromBuffer (ByteBuffer b) throws IOException

Protected Member Functions

void decodePayload (byte[] pl)
void finishedPayload (byte[] pl) throws IOException
OperationStatus getStatusForErrorCode (int errCode, byte[] errPl)
boolean opaqueIsValid ()
 OperationImpl (int c, int o, OperationCallback cb)
void prepareBuffer (String key, long cas, byte[] val, Object...extraHeaders)
void resetInput ()

Protected Attributes

int errorCode
final int opaque
long responseCas
int responseCmd
int responseOpaque

Static Protected Attributes

static final byte[] EMPTY_BYTES = new byte[0]
static final int ERR_EXISTS = 2
static final int ERR_NOT_FOUND = 1
static final int ERR_NOT_STORED = 5
static final OperationStatus EXISTS_STATUS
static final int MIN_RECV_PACKET = 24
static final OperationStatus NOT_FOUND_STATUS
static final OperationStatus NOT_STORED_STATUS
static final byte REQ_MAGIC = (byte)0x80
static final byte RES_MAGIC = (byte)0x81
static final OperationStatus STATUS_OK

Static Package Functions

static int decodeInt (byte[] data, int i)
static long decodeLong (byte[] data, int i)
static int decodeShort (byte[] data, int i)
static long decodeUnsignedInt (byte[] data, int i)
static int generateOpaque ()

Private Attributes

final int cmd
final byte[] header = new byte[MIN_RECV_PACKET]
int headerOffset = 0
byte[] payload = null
int payloadOffset = 0

Static Private Attributes

static final AtomicInteger seqNumber = new AtomicInteger(0)


Detailed Description

Base class for binary operations.

Constructor & Destructor Documentation

OperationImpl ( int  c,
int  o,
OperationCallback  cb 
) [protected]

Construct with opaque.

Parameters:
o the opaque value.
cb 


Member Function Documentation

static int decodeInt ( byte[]  data,
int  i 
) [static, package]

static long decodeLong ( byte[]  data,
int  i 
) [static, package]

void decodePayload ( byte[]  pl  )  [protected]

Decode the given payload for this command.

Parameters:
pl the payload.

Reimplemented in GetOperationImpl, MutatorOperationImpl, and VersionOperationImpl.

static int decodeShort ( byte[]  data,
int  i 
) [static, package]

static long decodeUnsignedInt ( byte[]  data,
int  i 
) [static, package]

void finishedPayload ( byte[]  pl  )  throws IOException [protected]

Reimplemented in MultiGetOperationImpl.

static int generateOpaque (  )  [static, package]

Generate an opaque ID.

OperationStatus getStatusForErrorCode ( int  errCode,
byte[]  errPl 
) [protected]

Get the OperationStatus object for the given error code.

Parameters:
errCode the error code
Returns:
the status to return, or null if this is an exceptional case

Reimplemented in ConcatenationOperationImpl, DeleteOperationImpl, GetOperationImpl, MutatorOperationImpl, and StoreOperationImpl.

boolean opaqueIsValid (  )  [protected]

Validate an opaque value from the header. This may be overridden from a subclass where the opaque isn't expected to always be the same as the request opaque.

Reimplemented in MultiGetOperationImpl.

void prepareBuffer ( String  key,
long  cas,
byte[]  val,
Object...  extraHeaders 
) [protected]

Prepare a send buffer.

Parameters:
cmd the command identifier
key the key (for keyed ops)
val the data payload
extraHeaders any additional headers that need to be sent

void readFromBuffer ( ByteBuffer  b  )  throws IOException [virtual]

Implements BaseOperationImpl.

void resetInput (  )  [protected]


Member Data Documentation

final int cmd [private]

Reimplemented from BaseOperationImpl.

final byte [] EMPTY_BYTES = new byte[0] [static, protected]

final int ERR_EXISTS = 2 [static, protected]

final int ERR_NOT_FOUND = 1 [static, protected]

Error code for items that were not found.

final int ERR_NOT_STORED = 5 [static, protected]

int errorCode [protected]

final OperationStatus EXISTS_STATUS [static, protected]

Initial value:

                new CASOperationStatus(false, "Object exists", CASResponse.EXISTS)

final byte [] header = new byte[MIN_RECV_PACKET] [private]

int headerOffset = 0 [private]

final int MIN_RECV_PACKET = 24 [static, protected]

final OperationStatus NOT_FOUND_STATUS [static, protected]

Initial value:

                new CASOperationStatus(false, "Not Found", CASResponse.NOT_FOUND)

final OperationStatus NOT_STORED_STATUS [static, protected]

Initial value:

                new CASOperationStatus(false, "Not Stored", CASResponse.NOT_FOUND)

final int opaque [protected]

byte [] payload = null [private]

int payloadOffset = 0 [private]

final byte REQ_MAGIC = (byte)0x80 [static, protected]

final byte RES_MAGIC = (byte)0x81 [static, protected]

long responseCas [protected]

int responseCmd [protected]

int responseOpaque [protected]

final AtomicInteger seqNumber = new AtomicInteger(0) [static, private]

final OperationStatus STATUS_OK [static, protected]

Initial value:

                new CASOperationStatus(true, "OK", CASResponse.OK)


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:38 2012 for Project Wonder by  doxygen 1.5.8