net.spy.memcached.protocol.ascii
Class AsciiOperationFactory

java.lang.Object
  extended by net.spy.memcached.ops.BaseOperationFactory
      extended by net.spy.memcached.protocol.ascii.AsciiOperationFactory
All Implemented Interfaces:
OperationFactory

public class AsciiOperationFactory
extends BaseOperationFactory

Operation factory for the ascii protocol.


Constructor Summary
AsciiOperationFactory()
           
 
Method Summary
 CASOperation cas(StoreType type, java.lang.String key, long casId, int flags, int exp, byte[] data, OperationCallback cb)
          Create a CAS operation.
 ConcatenationOperation cat(ConcatenationType catType, long casId, java.lang.String key, byte[] data, OperationCallback cb)
          Get a concatenation operation.
protected  java.util.Collection<? extends Operation> cloneGet(KeyedOperation op)
           
 DeleteOperation delete(java.lang.String key, OperationCallback cb)
          Create a deletion operation.
 FlushOperation flush(int delay, OperationCallback cb)
          Create a flush operation.
 GetOperation get(java.util.Collection<java.lang.String> keys, GetOperation.Callback cb)
          Create a get operation.
 GetOperation get(java.lang.String key, GetOperation.Callback cb)
          Create a get operation.
 GetAndTouchOperation getAndTouch(java.lang.String key, int expiration, GetAndTouchOperation.Callback cb)
          Gets the value of a key and resets its timeout.
 GetlOperation getl(java.lang.String key, int exp, GetlOperation.Callback cb)
          Create a getl operation.
 GetsOperation gets(java.lang.String key, GetsOperation.Callback cb)
          Create a gets operation.
 MutatorOperation mutate(Mutator m, java.lang.String key, long by, long exp, int def, OperationCallback cb)
          Create a mutator operation.
 NoopOperation noop(OperationCallback cb)
          Create a NOOP operation.
 SASLAuthOperation saslAuth(java.lang.String[] mech, java.lang.String serverName, java.util.Map<java.lang.String,?> props, javax.security.auth.callback.CallbackHandler cbh, OperationCallback cb)
          Create a new sasl auth operation.
 SASLMechsOperation saslMechs(OperationCallback cb)
          Create a new SASL mechs operation.
 SASLStepOperation saslStep(java.lang.String[] mech, byte[] challenge, java.lang.String serverName, java.util.Map<java.lang.String,?> props, javax.security.auth.callback.CallbackHandler cbh, OperationCallback cb)
          Create a new sasl step operation.
 StatsOperation stats(java.lang.String arg, StatsOperation.Callback cb)
          Get a new StatsOperation.
 StoreOperation store(StoreType storeType, java.lang.String key, int flags, int exp, byte[] data, OperationCallback cb)
          Create a store operation.
 TapOperation tapAck(TapOpcode opcode, int opaque, OperationCallback cb)
          Sends a tap ack message to the server.
 TapOperation tapBackfill(java.lang.String id, long date, OperationCallback cb)
          Creates a tap backfill stream.
 TapOperation tapCustom(java.lang.String id, RequestMessage message, OperationCallback cb)
          Creates a custom tap stream.
 TapOperation tapDump(java.lang.String id, OperationCallback cb)
          Sends a tap dump message to the server.
 KeyedOperation touch(java.lang.String key, int expiration, OperationCallback cb)
          Resets a keys expiration time.
 VersionOperation version(OperationCallback cb)
          Create a new version operation.
 
Methods inherited from class net.spy.memcached.ops.BaseOperationFactory
clone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsciiOperationFactory

public AsciiOperationFactory()
Method Detail

delete

public DeleteOperation delete(java.lang.String key,
                              OperationCallback cb)
Description copied from interface: OperationFactory
Create a deletion operation.

Parameters:
key - the key to delete
cb - the status callback
Returns:
the new DeleteOperation

flush

public FlushOperation flush(int delay,
                            OperationCallback cb)
Description copied from interface: OperationFactory
Create a flush operation.

Parameters:
delay - delay until flush.
cb - the status callback
Returns:
the new FlushOperation

getAndTouch

public GetAndTouchOperation getAndTouch(java.lang.String key,
                                        int expiration,
                                        GetAndTouchOperation.Callback cb)
Description copied from interface: OperationFactory
Gets the value of a key and resets its timeout.

Parameters:
key - the key to get a value for and reset its timeout
expiration - the new expiration for the key
cb - the callback that will contain the result
Returns:
a new GATOperation

get

public GetOperation get(java.lang.String key,
                        GetOperation.Callback cb)
Description copied from interface: OperationFactory
Create a get operation.

Parameters:
key - the key to get
cb - the callback that will contain the results
Returns:
a new GetOperation

get

public GetOperation get(java.util.Collection<java.lang.String> keys,
                        GetOperation.Callback cb)
Description copied from interface: OperationFactory
Create a get operation.

Parameters:
keys - the collection of keys to get
cb - the callback that will contain the results
Returns:
a new GetOperation

getl

public GetlOperation getl(java.lang.String key,
                          int exp,
                          GetlOperation.Callback cb)
Description copied from interface: OperationFactory
Create a getl operation. A getl gets the value for a key and then locks the value for a given amount of time. The maximum default lock time is 30 seconds.

Parameters:
key - the key to get and lock
exp - the amount of time the lock should be valid for in seconds.
cb - the callback that will contain the results
Returns:
a new GetOperation

gets

public GetsOperation gets(java.lang.String key,
                          GetsOperation.Callback cb)
Description copied from interface: OperationFactory
Create a gets operation.

Parameters:
key - the key to get
cb - the callback that will contain the results
Returns:
a new GetsOperation

mutate

public MutatorOperation mutate(Mutator m,
                               java.lang.String key,
                               long by,
                               long exp,
                               int def,
                               OperationCallback cb)
Description copied from interface: OperationFactory
Create a mutator operation.

Parameters:
m - the mutator type
key - the mutatee key
by - the amount to increment or decrement
exp - the default value
def - expiration in case we need to default (0 if no default)
cb - the status callback
Returns:
the new mutator operation

stats

public StatsOperation stats(java.lang.String arg,
                            StatsOperation.Callback cb)
Description copied from interface: OperationFactory
Get a new StatsOperation.

Parameters:
arg - the stat parameter (see protocol docs)
cb - the stats callback
Returns:
the new StatsOperation

store

public StoreOperation store(StoreType storeType,
                            java.lang.String key,
                            int flags,
                            int exp,
                            byte[] data,
                            OperationCallback cb)
Description copied from interface: OperationFactory
Create a store operation.

Parameters:
storeType - the type of store operation
key - the key to store
flags - the storage flags
exp - the expiration time
data - the data
cb - the status callback
Returns:
the new store operation

touch

public KeyedOperation touch(java.lang.String key,
                            int expiration,
                            OperationCallback cb)
Description copied from interface: OperationFactory
Resets a keys expiration time.

Parameters:
key - The key whose expiration time is to be reset.
expiration - The new expiration time for the key
cb - The status callback
Returns:
A touch operation

version

public VersionOperation version(OperationCallback cb)
Description copied from interface: OperationFactory
Create a new version operation.


noop

public NoopOperation noop(OperationCallback cb)
Description copied from interface: OperationFactory
Create a NOOP operation.

Parameters:
cb - the operation callback
Returns:
the new NoopOperation

cas

public CASOperation cas(StoreType type,
                        java.lang.String key,
                        long casId,
                        int flags,
                        int exp,
                        byte[] data,
                        OperationCallback cb)
Description copied from interface: OperationFactory
Create a CAS operation.

key - the key to store
casId - the CAS identifier value (from a gets operation)
flags - the storage flags
exp - the expiration time
data - the data
cb - the status callback
Returns:
the new store operation

cat

public ConcatenationOperation cat(ConcatenationType catType,
                                  long casId,
                                  java.lang.String key,
                                  byte[] data,
                                  OperationCallback cb)
Description copied from interface: OperationFactory
Get a concatenation operation.

Parameters:
catType - the type of concatenation to perform.
casId - the CAS value for an atomic compare-and-cat
key - the key
data - the data to store
cb - a callback for reporting the status
Returns:
thew new ConcatenationOperation

cloneGet

protected java.util.Collection<? extends Operation> cloneGet(KeyedOperation op)
Specified by:
cloneGet in class BaseOperationFactory

saslMechs

public SASLMechsOperation saslMechs(OperationCallback cb)
Description copied from interface: OperationFactory
Create a new SASL mechs operation.


saslStep

public SASLStepOperation saslStep(java.lang.String[] mech,
                                  byte[] challenge,
                                  java.lang.String serverName,
                                  java.util.Map<java.lang.String,?> props,
                                  javax.security.auth.callback.CallbackHandler cbh,
                                  OperationCallback cb)
Description copied from interface: OperationFactory
Create a new sasl step operation.


saslAuth

public SASLAuthOperation saslAuth(java.lang.String[] mech,
                                  java.lang.String serverName,
                                  java.util.Map<java.lang.String,?> props,
                                  javax.security.auth.callback.CallbackHandler cbh,
                                  OperationCallback cb)
Description copied from interface: OperationFactory
Create a new sasl auth operation.


tapBackfill

public TapOperation tapBackfill(java.lang.String id,
                                long date,
                                OperationCallback cb)
Description copied from interface: OperationFactory
Creates a tap backfill stream. See http://www.couchbase.org/wiki/display/membase/TAP+Protocol for more details on the tap protocol. TAP connection names are optional, but allow for momentary interruptions in connection to automatically restart. TAP connection names also appear in TAP stats from the given server. Note that according to the protocol, TAP backfill dates are advisory and the protocol guarantees at least data from specified date forward, but earlier mutations may be received.

Parameters:
id - The name for the TAP connection
date - The date to start backfill from.
cb - The status callback.
Returns:
The tap operation used to create and handle the stream.

tapCustom

public TapOperation tapCustom(java.lang.String id,
                              RequestMessage message,
                              OperationCallback cb)
Description copied from interface: OperationFactory
Creates a custom tap stream. See http://www.couchbase.org/wiki/display/membase/TAP+Protocol for more details on the tap protocol. TAP connection names are optional, but allow for momentary interruptions in connection to automatically restart. TAP connection names also appear in TAP stats from the given server.

Parameters:
id - The name for the TAP connection
message - The tap message to send.
cb - The status callback.
Returns:
The tap operation used to create and handle the stream.

tapAck

public TapOperation tapAck(TapOpcode opcode,
                           int opaque,
                           OperationCallback cb)
Description copied from interface: OperationFactory
Sends a tap ack message to the server. See http://www.couchbase.org/wiki/display/membase/TAP+Protocol for more details on the tap protocol.

Parameters:
opcode - the opcode sent to the client by the server.
opaque - the opaque value sent to the client by the server.
cb - the callback for the tap stream.
Returns:
a tap ack operation.

tapDump

public TapOperation tapDump(java.lang.String id,
                            OperationCallback cb)
Description copied from interface: OperationFactory
Sends a tap dump message to the server. See http://www.couchbase.org/wiki/display/membase/TAP+Protocol for more details on the tap protocol.

Parameters:
id - the name for the TAP connection
cb - the callback for the tap stream.
Returns:
a tap dump operation.


Copyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.