net.spy.memcached.ops
Interface Operation

All Known Subinterfaces:
CASOperation, ConcatenationOperation, DeleteOperation, FlushOperation, GetOperation, GetsOperation, KeyedOperation, MutatorOperation, NoopOperation, StatsOperation, StoreOperation, VersionOperation
All Known Implementing Classes:
ConcatenationOperationImpl, OptimizedSetImpl, StatsOperationImpl

public interface Operation

Base interface for all operations.


Method Summary
 void cancel()
          Cancel this operation.
 ByteBuffer getBuffer()
          Get the write buffer for this operation.
 OperationCallback getCallback()
          Get the callback for this get operation.
 OperationException getException()
          Get the exception that occurred (or null if no exception occurred).
 MemcachedNode getHandlingNode()
          Get the node that should've been handling this operation.
 OperationState getState()
          Get the current state of this operation.
 void handleRead(ByteBuffer data)
          Handle a raw data read.
 boolean hasErrored()
          True if an error occurred while processing this operation.
 void initialize()
          Initialize this operation.
 boolean isCancelled()
          Has this operation been cancelled?
 void readFromBuffer(ByteBuffer data)
          Read data from the given byte buffer and dispatch to the appropriate read mechanism.
 void setHandlingNode(MemcachedNode to)
          Set a reference to the node that will be/is handling this operation.
 void writeComplete()
          Invoked after having written all of the bytes from the supplied output buffer.
 

Method Detail

isCancelled

boolean isCancelled()
Has this operation been cancelled?


hasErrored

boolean hasErrored()
True if an error occurred while processing this operation.


getException

OperationException getException()
Get the exception that occurred (or null if no exception occurred).


getCallback

OperationCallback getCallback()
Get the callback for this get operation.


cancel

void cancel()
Cancel this operation.


getState

OperationState getState()
Get the current state of this operation.


getBuffer

ByteBuffer getBuffer()
Get the write buffer for this operation.


writeComplete

void writeComplete()
Invoked after having written all of the bytes from the supplied output buffer.


initialize

void initialize()
Initialize this operation. This is used to prepare output byte buffers and stuff.


readFromBuffer

void readFromBuffer(ByteBuffer data)
                    throws IOException
Read data from the given byte buffer and dispatch to the appropriate read mechanism.

Throws:
IOException

handleRead

void handleRead(ByteBuffer data)
Handle a raw data read.


getHandlingNode

MemcachedNode getHandlingNode()
Get the node that should've been handling this operation.


setHandlingNode

void setHandlingNode(MemcachedNode to)
Set a reference to the node that will be/is handling this operation.

Parameters:
to - a memcached node