ClientSession

class ClientSession(val wrapped: ClientSession) : ClientSession

A client session that supports transactions.

Constructors

Link copied to clipboard
constructor(wrapped: ClientSession)

Functions

Link copied to clipboard
suspend fun abortTransaction()

Abort a transaction in the context of this session. A transaction can only be aborted if one has first been started.

Link copied to clipboard
open override fun advanceClusterTime(clusterTime: BsonDocument?)
Link copied to clipboard
open override fun advanceOperationTime(operationTime: BsonTimestamp?)

Set the operation time of the last operation executed in this session.

Link copied to clipboard
open override fun clearTransactionContext()

Clears the transaction context.

Link copied to clipboard
open override fun close()
Link copied to clipboard
suspend fun commitTransaction()

Commit a transaction in the context of this session. A transaction can only be commmited if one has first been started.

Link copied to clipboard
open override fun getClusterTime(): BsonDocument
Link copied to clipboard
open override fun getOperationTime(): BsonTimestamp

Gets the operation time of the last operation executed in this session.

Link copied to clipboard
open override fun getOptions(): ClientSessionOptions

Get the options for this session.

Link copied to clipboard
open override fun getOriginator(): Any

Gets the originator for the session.

Link copied to clipboard
open override fun getPinnedServerAddress(): ServerAddress?

Get the server address of the pinned mongos on this session. For internal use only.

Link copied to clipboard
open override fun getRecoveryToken(): BsonDocument?

Get the recovery token from the latest outcome in a sharded transaction. For internal use only.

Link copied to clipboard
open override fun getServerSession(): ServerSession
Link copied to clipboard
open override fun getSnapshotTimestamp(): BsonTimestamp?

For internal use only.

Link copied to clipboard
open override fun getTransactionContext(): Any?

Gets the transaction context.

Link copied to clipboard
fun getTransactionOptions(): TransactionOptions

Gets the transaction options. Only call this method of the session has an active transaction

Link copied to clipboard

Returns true if there is an active transaction on this session, and false otherwise

Link copied to clipboard
open override fun isCausallyConsistent(): Boolean

Returns true if operations in this session must be causally consistent

Link copied to clipboard

Notify the client session that a message has been sent.

Link copied to clipboard

Notify the client session that command execution is being initiated. This should be called before server selection occurs.

Link copied to clipboard
open override fun setRecoveryToken(recoveryToken: BsonDocument)

Set the recovery token. For internal use only.

Link copied to clipboard
open override fun setSnapshotTimestamp(snapshotTimestamp: BsonTimestamp?)

For internal use only.

Link copied to clipboard
open override fun setTransactionContext(address: ServerAddress, transactionContext: Any)

Sets the transaction context.

Link copied to clipboard

Start a transaction in the context of this session with default transaction options. A transaction can not be started if there is already an active transaction on this session.

fun startTransaction(transactionOptions: TransactionOptions)

Start a transaction in the context of this session with the given transaction options. A transaction can not be started if there is already an active transaction on this session.

Properties

Link copied to clipboard
val wrapped: ClientSession