Package oracle.kv

# Interface OperationFactory

public interface OperationFactory
A factory to create operations that can be batched for execution by `KVStore.execute`.

Each operation created here operates on a single key and matches the corresponding operation defined in KVStore. For example, the Operation generated by the `createPut` method corresponds to the `put` method. The argument pattern for creating the operation is similar. It differs in the following respects:

- The durability argument is not passed, since that argument applies to the execution of the entire batch of operations and is passed in to the `execute` method.
- `ReturnValueVersion.Choice` is passed instead of `ReturnValueVersion`.
- An additional argument, `abortIfUnsuccessful` is passed.

The return values associated with operations similarly match the descriptions for the corresponding methods described in in `KVStore`. They are, however, retrieved differently: the status, return value, previous value and version are packaged together in `OperationResult`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Operation`
  `createDelete(Key key)`
  Create a Delete operation suitable for use as an argument to the `execute` method.
  `Operation`
  `createDelete(Key key, ReturnValueVersion.Choice prevReturn, boolean abortIfUnsuccessful)`
  Create a Delete operation suitable for use as an argument to the `execute` method.
  `Operation`
  `createDeleteIfVersion(Key key, Version version)`
  Create a Delete operation suitable for use as an argument to the `execute` method.
  `Operation`
  `createDeleteIfVersion(Key key, Version version, ReturnValueVersion.Choice prevReturn, boolean abortIfUnsuccessful)`
  Create a Delete operation suitable for use as an argument to the `execute` method.
  `Operation`
  `createPut(Key key, Value value)`
  Create a Put operation suitable for use as an argument to the `execute` method.
  `Operation`
  `createPut(Key key, Value value, ReturnValueVersion.Choice prevReturn, boolean abortIfUnsuccessful)`
  Create a Put operation suitable for use as an argument to the `execute` method.
  `Operation`
  `createPutIfAbsent(Key key, Value value)`
  Create a Put operation suitable for use as an argument to the `execute` method.
  `Operation`
  `createPutIfAbsent(Key key, Value value, ReturnValueVersion.Choice prevReturn, boolean abortIfUnsuccessful)`
  Create a Put operation suitable for use as an argument to the `execute` method.
  `Operation`
  `createPutIfPresent(Key key, Value value)`
  Create a Put operation suitable for use as an argument to the `execute` method.
  `Operation`
  `createPutIfPresent(Key key, Value value, ReturnValueVersion.Choice prevReturn, boolean abortIfUnsuccessful)`
  Create a Put operation suitable for use as an argument to the `execute` method.
  `Operation`
  `createPutIfVersion(Key key, Value value, Version version)`
  Create a Put operation suitable for use as an argument to the `execute` method.
  `Operation`
  `createPutIfVersion(Key key, Value value, Version version, ReturnValueVersion.Choice prevReturn, boolean abortIfUnsuccessful)`
  Create a Put operation suitable for use as an argument to the `execute` method.

- ## Method Details

  - ### createPut

    Operation createPut(Key key, Value value)
    Create a Put operation suitable for use as an argument to the `execute` method. The semantics of the returned operation are identical to that of the `put` method.

    The previous value is not returned by this method and the `abortIfUnsuccessful` property is false.

    The result of evaluating the operation, or the resulting exception, after the call to `execute` is available as an `OperationResult`.

    Returns:
      the created Put operation
    See Also:
      - `put`
      - `execute`

  - ### createPut

    Operation createPut(Key key, Value value, ReturnValueVersion.Choice prevReturn, boolean abortIfUnsuccessful)
    Create a Put operation suitable for use as an argument to the `execute` method. The semantics of the returned operation are identical to that of the `put` method.

    The result of evaluating the operation, or the resulting exception, after the call to `execute` is available as an `OperationResult`.

    Parameters:
      `abortIfUnsuccessful` - is true if this operation should cause the `execute` transaction to abort when the operation fails, where failure is the condition when the `put` method returns null.
    Returns:
      the created Put operation
    See Also:
      - `put`
      - `execute`

  - ### createPutIfAbsent

    Operation createPutIfAbsent(Key key, Value value)
    Create a Put operation suitable for use as an argument to the `execute` method. The semantics of the returned operation are identical to that of the `putIfAbsent` method.

    The previous value is not returned by this method and the `abortIfUnsuccessful` property is false.

    The result of evaluating the operation, or the resulting exception, after the call to `execute` is available as an `OperationResult`.

    Returns:
      the created Put operation
    See Also:
      - `putIfAbsent`
      - `execute`

  - ### createPutIfAbsent

    Operation createPutIfAbsent(Key key, Value value, ReturnValueVersion.Choice prevReturn, boolean abortIfUnsuccessful)
    Create a Put operation suitable for use as an argument to the `execute` method. The semantics of the returned operation are identical to that of the `putIfAbsent` method.

    The result of evaluating the operation, or the resulting exception, after the call to `execute` is available as an `OperationResult`.

    Parameters:
      `abortIfUnsuccessful` - is true if this operation should cause the `execute` transaction to abort when the operation fails, where failure is the condition when the `putIfAbsent` method returns null.
    Returns:
      the created Put operation
    See Also:
      - `putIfAbsent`
      - `execute`

  - ### createPutIfPresent

    Operation createPutIfPresent(Key key, Value value)
    Create a Put operation suitable for use as an argument to the `execute` method. The semantics of the returned operation are identical to that of the `putIfPresent` method.

    The previous value is not returned by this method and the `abortIfUnsuccessful` property is false.

    The result of evaluating the operation, or the resulting exception, after the call to `execute` is available as an `OperationResult`.

    Returns:
      the created Put operation
    See Also:
      - `putIfPresent`
      - `execute`

  - ### createPutIfPresent

    Operation createPutIfPresent(Key key, Value value, ReturnValueVersion.Choice prevReturn, boolean abortIfUnsuccessful)
    Create a Put operation suitable for use as an argument to the `execute` method. The semantics of the returned operation are identical to that of the `putIfPresent` method.

    The result of evaluating the operation, or the resulting exception, after the call to `execute` is available as an `OperationResult`.

    Parameters:
      `abortIfUnsuccessful` - is true if this operation should cause the `execute` transaction to abort when the operation fails, where failure is the condition when the `putIfPresent` method returns null.
    Returns:
      the created Put operation
    See Also:
      - `putIfPresent`
      - `execute`

  - ### createPutIfVersion

    Operation createPutIfVersion(Key key, Value value, Version version)
    Create a Put operation suitable for use as an argument to the `execute` method. The semantics of the returned operation are identical to that of the `putIfVersion` method.

    The previous value is not returned by this method and the `abortIfUnsuccessful` property is false.

    The result of evaluating the operation, or the resulting exception, after the call to `execute` is available as an `OperationResult`.

    Returns:
      the created Put operation
    See Also:
      - `putIfVersion`
      - `execute`

  - ### createPutIfVersion

    Operation createPutIfVersion(Key key, Value value, Version version, ReturnValueVersion.Choice prevReturn, boolean abortIfUnsuccessful)
    Create a Put operation suitable for use as an argument to the `execute` method. The semantics of the returned operation are identical to that of the `putIfVersion` method.

    The result of evaluating the operation, or the resulting exception, after the call to `execute` is available as an `OperationResult`.

    Parameters:
      `abortIfUnsuccessful` - is true if this operation should cause the `execute` transaction to abort when the operation fails, where failure is the condition when the `putIfVersion` method returns null.
    Returns:
      the created Put operation
    See Also:
      - `putIfVersion`
      - `execute`

  - ### createDelete

    Operation createDelete(Key key)
    Create a Delete operation suitable for use as an argument to the `execute` method. The semantics of the returned operation when executed are identical to that of the `delete` method.

    The previous value is not returned by this method and the `abortIfUnsuccessful` property is false.

    The result of evaluating the operation, or the resulting exception, after the call to `execute` is available as an `OperationResult`.

    Returns:
      the created Delete operation
    See Also:
      - `delete`
      - `execute`

  - ### createDelete

    Operation createDelete(Key key, ReturnValueVersion.Choice prevReturn, boolean abortIfUnsuccessful)
    Create a Delete operation suitable for use as an argument to the `execute` method. The semantics of the returned operation when executed are identical to that of the `delete` method.

    The result of evaluating the operation, or the resulting exception, after the call to `execute` is available as an `OperationResult`.

    Parameters:
      `abortIfUnsuccessful` - is true if this operation should cause the `execute` transaction to abort when the operation fails, where failure is the condition when the `delete` method returns false.
    Returns:
      the created Delete operation
    See Also:
      - `delete`
      - `execute`

  - ### createDeleteIfVersion

    Operation createDeleteIfVersion(Key key, Version version)
    Create a Delete operation suitable for use as an argument to the `execute` method. The semantics of the returned operation when executed are identical to that of the `deleteIfVersion` method.

    The previous value is not returned by this method and the `abortIfUnsuccessful` property is false.

    The result of evaluating the operation, or the resulting exception, after the call to `execute` is available as an `OperationResult`.

    Returns:
      the created Delete operation
    See Also:
      - `deleteIfVersion`
      - `execute`

  - ### createDeleteIfVersion

    Operation createDeleteIfVersion(Key key, Version version, ReturnValueVersion.Choice prevReturn, boolean abortIfUnsuccessful)
    Create a Delete operation suitable for use as an argument to the `execute` method. The semantics of the returned operation when executed are identical to that of the `deleteIfVersion` method.

    The result of evaluating the operation, or the resulting exception, after the call to `execute` is available as an `OperationResult`.

    Parameters:
      `abortIfUnsuccessful` - is true if this operation should cause the `execute` transaction to abort when the operation fails, where failure is the condition when the `deleteIfVersion` method returns false.
    Returns:
      the created Delete operation
    See Also:
      - `deleteIfVersion`
      - `execute`