gremlin
    Preparing search index...

    Controls an explicit remote transaction. A thin wrapper around a Client that adds transaction lifecycle (begin/commit/rollback/close) and attaches a transactionId to every request.

    Created via Client.transact() or g.tx(). The traversal source (g alias) is inherited from the Client and cannot be changed.

    Transactions are short-lived and single-use. After commit or rollback, the transaction ID is invalid and the object cannot be reused.

    Each traversal on the transaction-bound source must be awaited before submitting the next, to ensure the server receives requests in order.

    This class is NOT thread-safe. Do not share a Transaction across concurrent async contexts without external synchronization.

    Index

    Constructors

    Accessors

    Methods

    • Spawns a GraphTraversalSource that is bound to a remote transaction.

      begin() is idempotent: calling it while a transaction is already open does not send a second begin to the server and does not throw - it reuses the existing transaction ID and returns a source bound to the same transaction. A transaction is single-use, so calling begin() after it has been closed (commit/rollback/failed begin) throws.

      Returns Promise<GraphTraversalSource>

    • Submits a gremlin-lang string within this transaction. The transactionId is automatically attached. Has the same signature as Client.submit().

      Parameters

      • gremlin: string
      • Optionalparameters: any
      • OptionalrequestOptions: any

      Returns Promise<any>