Packages

c

com.couchbase.client.scala.transactions

TransactionAttemptContext

class TransactionAttemptContext extends AnyRef

Provides methods to allow an application's transaction logic to read, mutate, insert and delete documents.

These methods are blocking/synchronous. See ReactiveTransactionAttemptContext for the asynchronous version.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TransactionAttemptContext
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def get(collection: Collection, id: String): Try[TransactionGetResult]

    Gets a document from the specified Couchbase collection matching the specified id.

    Gets a document from the specified Couchbase collection matching the specified id. If the document is not found, a com.couchbase.client.core.error.DocumentNotFoundException is raised.

    collection

    the Couchbase collection the document exists on

    id

    the document's ID

    returns

    a TransactionGetResult containing the document

  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  11. def insert[T](collection: Collection, id: String, content: T)(implicit serializer: JsonSerializer[T]): Try[TransactionGetResult]

    Inserts a new document into the specified Couchbase collection.

    Inserts a new document into the specified Couchbase collection.

    The insert is staged until the transaction is committed. No other actor will be able to see this inserted document until that point.

    This staged data effectively locks the document from other transactional writes until the attempt completes (commits or rolls back).

    collection

    the Couchbase collection in which to insert the doc

    id

    the document's unique ID

    content

    this can be of any type for which an implicit com.couchbase.client.scala.codec.Conversions.JsonSerializer can be found: a list of types that are supported 'out of the box' is available at these JSON docs

  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  16. def query(scope: Scope, statement: String, options: TransactionQueryOptions): Try[TransactionQueryResult]

    Runs a N1QL query and returns the result.

    Runs a N1QL query and returns the result.

    All rows are buffered in-memory.

    This overload performs a 'scope-level query': that is, one in which a collection may be referenced by name in the query statement, without needing to specify the full bucket.scope.collection syntax.

    Raises CouchbaseException or an error derived from it on failure. The application can choose to catch and ignore this error, and the transaction attempt is allowed to continue. This differs from Key-Value operations, whose failure will generally cause the attempt to fail.

  17. def query(scope: Scope, statement: String): Try[TransactionQueryResult]

    Runs a N1QL query and returns the result.

    Runs a N1QL query and returns the result.

    All rows are buffered in-memory.

    This overload performs a 'scope-level query': that is, one in which a collection may be referenced by name in the query statement, without needing to specify the full bucket.scope.collection syntax.

    Raises CouchbaseException or an error derived from it on failure. The application can choose to catch and ignore this error, and the transaction attempt is allowed to continue. This differs from Key-Value operations, whose failure will generally cause the attempt to fail.

  18. def query(statement: String, options: TransactionQueryOptions): Try[TransactionQueryResult]

    Runs a N1QL query and returns the result.

    Runs a N1QL query and returns the result.

    All rows are buffered in-memory.

    Raises CouchbaseException or an error derived from it on failure. The application can choose to catch and ignore this error, and the transaction attempt is allowed to continue. This differs from Key-Value operations, whose failure will generally cause the attempt to fail.

  19. def query(statement: String): Try[TransactionQueryResult]

    Runs a N1QL query and returns the result.

    Runs a N1QL query and returns the result.

    All rows are buffered in-memory.

    Raises CouchbaseException or an error derived from it on failure. The application can choose to catch and ignore this error, and the transaction attempt is allowed to continue. This differs from Key-Value operations, whose failure will generally cause the attempt to fail.

  20. def remove(doc: TransactionGetResult): Try[Unit]

    Removes the specified doc.

    Removes the specified doc.

    The remove is staged until the transaction is committed. That is, the document will continue to exist, and the rest of the Couchbase platform will continue to see it.

    This staged data effectively locks the document from other transactional writes until the attempt completes (commits or rolls back).

    doc

    the doc to be removed

  21. def replace[T](doc: TransactionGetResult, content: T)(implicit serializer: JsonSerializer[T]): Try[TransactionGetResult]

    Mutates the specified doc with new content.

    Mutates the specified doc with new content.

    The mutation is staged until the transaction is committed. That is, any read of the document by any Couchbase component will see the document's current value, rather than this staged or 'dirty' data. If the attempt is rolled back, the staged mutation will be removed.

    This staged data effectively locks the document from other transactional writes until the attempt completes (commits or rolls back).

    doc

    the doc to be updated

    content

    this can be of any type for which an implicit com.couchbase.client.scala.codec.Conversions.JsonSerializer can be found: a list of types that are supported 'out of the box' is available at these JSON docs

    returns

    the doc, updated with its new CAS value. For performance a copy is not created and the original doc object is modified.

  22. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  23. def toString(): String
    Definition Classes
    AnyRef → Any
  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped