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.
- Alphabetic
- By Inheritance
- TransactionAttemptContext
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @IntrinsicCandidate()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
get(collection: Collection, id: String): Try[TransactionGetResult]
Gets a document from the specified Couchbase
collection
matching the specifiedid
.Gets a document from the specified Couchbase
collection
matching the specifiedid
. 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
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
def
getReplicaFromPreferredServerGroup(collection: Collection, id: String): Try[TransactionGetResult]
Gets a document from the specified Couchbase
collection
matching the specifiedid
.Gets a document from the specified Couchbase
collection
matching the specifiedid
.It will be fetched only from document copies that on nodes in the preferred server group, which can be configured with com.couchbase.client.scala.env.ClusterEnvironment.Builder.preferredServerGroup.
If no replica can be retrieved, which can include for reasons such as this preferredServerGroup not being set, and misconfigured server groups, then com.couchbase.client.core.error.DocumentUnretrievableException can be raised. It is strongly recommended that this method always be used with a fallback strategy to use ctx.get() on failure.
- collection
the Couchbase collection the document exists on
- id
the document's ID
- returns
a
TransactionGetResult
containing the document
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
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
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
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.
-
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.
-
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.
-
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.
-
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
-
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.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated