Interface OperationFactory

    • Method Detail

      • delete

        DeleteOperation delete​(java.lang.String key,
                               DeleteOperation.Callback callback)
        Create a deletion operation.
        Parameters:
        key - the key to delete
        callback - the status callback
        Returns:
        the new DeleteOperation
      • delete

        DeleteOperation delete​(java.lang.String key,
                               long cas,
                               DeleteOperation.Callback callback)
        Create a deletion operation with CAS.
        Parameters:
        key - the key to delete
        cas - the CAS value to pass along
        callback - the status callback
        Returns:
        the new DeleteOperation
      • unlock

        UnlockOperation unlock​(java.lang.String key,
                               long casId,
                               OperationCallback operationCallback)
        Create a Unlock operation.
        Parameters:
        key - the key to unlock
        casId - the value of CAS
        operationCallback - the status callback
        Returns:
        the new UnlockOperation
      • observe

        ObserveOperation observe​(java.lang.String key,
                                 long casId,
                                 int index,
                                 ObserveOperation.Callback operationCallback)
        Create an Observe operation.
        Parameters:
        key - the key to observe
        casId - the value of CAS
        index - the VBucket index of key
        operationCallback - the status callback
        Returns:
        the new ObserveOperation
      • flush

        FlushOperation flush​(int delay,
                             OperationCallback operationCallback)
        Create a flush operation.
        Parameters:
        delay - delay until flush.
        operationCallback - the status callback
        Returns:
        the new FlushOperation
      • getAndTouch

        GetAndTouchOperation getAndTouch​(java.lang.String key,
                                         int expiration,
                                         GetAndTouchOperation.Callback cb)
        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

        GetOperation get​(java.lang.String key,
                         GetOperation.Callback callback)
        Create a get operation.
        Parameters:
        key - the key to get
        callback - the callback that will contain the results
        Returns:
        a new GetOperation
      • replicaGet

        ReplicaGetOperation replicaGet​(java.lang.String key,
                                       int index,
                                       ReplicaGetOperation.Callback callback)
        Create a replica get operation.
        Parameters:
        key - the key to get
        callback - the callback that will contain the results
        Returns:
        a new ReplicaGetOperation
      • replicaGets

        ReplicaGetsOperation replicaGets​(java.lang.String key,
                                         int index,
                                         ReplicaGetsOperation.Callback callback)
        Create a replica gets operation.
        Parameters:
        key - the key to get
        callback - the callback that will contain the results
        Returns:
        a new ReplicaGetOperation
      • getl

        GetlOperation getl​(java.lang.String key,
                           int exp,
                           GetlOperation.Callback callback)
        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.
        callback - the callback that will contain the results
        Returns:
        a new GetOperation
      • gets

        GetsOperation gets​(java.lang.String key,
                           GetsOperation.Callback callback)
        Create a gets operation.
        Parameters:
        key - the key to get
        callback - the callback that will contain the results
        Returns:
        a new GetsOperation
      • get

        GetOperation get​(java.util.Collection<java.lang.String> keys,
                         GetOperation.Callback cb)
        Create a get operation.
        Parameters:
        keys - the collection of keys to get
        cb - the callback that will contain the results
        Returns:
        a new GetOperation
      • keyStats

        StatsOperation keyStats​(java.lang.String key,
                                StatsOperation.Callback cb)
        Get a new KeyStatsOperation.
        Parameters:
        key - the key to get stats for
        cb - the stats callback
        Returns:
        the new StatsOperation
      • mutate

        MutatorOperation mutate​(Mutator m,
                                java.lang.String key,
                                long by,
                                long def,
                                int exp,
                                OperationCallback cb)
        Create a mutator operation.
        Parameters:
        m - the mutator type
        key - the mutatee key
        by - the amount to increment or decrement
        def - the default value
        exp - expiration in case we need to default (0 if no default)
        cb - the status callback
        Returns:
        the new mutator operation
      • stats

        StatsOperation stats​(java.lang.String arg,
                             StatsOperation.Callback cb)
        Get a new StatsOperation.
        Parameters:
        arg - the stat parameter (see protocol docs)
        cb - the stats callback
        Returns:
        the new StatsOperation
      • store

        StoreOperation store​(StoreType storeType,
                             java.lang.String key,
                             int flags,
                             int exp,
                             byte[] data,
                             StoreOperation.Callback cb)
        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

        TouchOperation touch​(java.lang.String key,
                             int expiration,
                             OperationCallback cb)
        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
      • cat

        ConcatenationOperation cat​(ConcatenationType catType,
                                   long casId,
                                   java.lang.String key,
                                   byte[] data,
                                   OperationCallback cb)
        Get a concatenation operation.
        Parameters:
        catType - the type of concatenation to perform.
        key - the key
        casId - the CAS value for an atomic compare-and-cat
        data - the data to store
        cb - a callback for reporting the status
        Returns:
        thew new ConcatenationOperation
      • cas

        CASOperation cas​(StoreType t,
                         java.lang.String key,
                         long casId,
                         int flags,
                         int exp,
                         byte[] data,
                         StoreOperation.Callback cb)
        Create a CAS operation.
        Parameters:
        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
      • saslAuth

        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.
      • saslStep

        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.
      • clone

        java.util.Collection<Operation> clone​(KeyedOperation op)
        Clone an operation.

        This is used for requeueing operations after a server is found to be down.

        Note that it returns more than one operation because a multi-get could potentially need to be played against a large number of underlying servers. In this case, there's a separate operation for each, and callback façade to reassemble them. It is left up to the operation pipeline to perform whatever optimization is required to turn these back into multi-gets.

        Parameters:
        op - the operation to clone
        Returns:
        a new operation for each key in the original operation
      • tapBackfill

        TapOperation tapBackfill​(java.lang.String id,
                                 long date,
                                 OperationCallback cb)
        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

        TapOperation tapCustom​(java.lang.String id,
                               RequestMessage message,
                               OperationCallback cb)
        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.