Package xtdb.api.tx

Class Transaction.Builder

java.lang.Object
xtdb.api.tx.Transaction.Builder
Enclosing class:
Transaction

public static final class Transaction.Builder extends Object
  • Method Details

    • add

      public Transaction.Builder add(TransactionOperation operation)
    • put

      public Transaction.Builder put(XtdbDocument document)
      Adds a put operation to the transaction, putting the given document at validTime = now.
      Returns:
      this
    • put

      public Transaction.Builder put(XtdbDocument document, Date startValidTime)
      Adds a put operation to the transaction, putting the given document starting from the given valid time
      Returns:
      this
    • put

      public Transaction.Builder put(XtdbDocument document, Date startValidTime, Date endValidTime)
      Adds a put operation to the transaction, putting the given document starting for the given validTime range
      Returns:
      this
    • delete

      public Transaction.Builder delete(Object id)
      Adds a delete operation to the transaction, deleting the given document from validTime = now.
      Returns:
      this
    • delete

      public Transaction.Builder delete(Object id, Date startValidTime)
      Adds a delete operation to the transaction, deleting the given document starting from the given valid time
      Returns:
      this
    • delete

      public Transaction.Builder delete(Object id, Date startValidTime, Date endValidTime)
      Adds a delete operation to the transaction, deleting the given document starting for the given validTime range
      Returns:
      this
    • evict

      public Transaction.Builder evict(Object id)
      Adds an evict operation to the transaction, removing all trace of the entity with the given ID. Eviction also removes all history of the entity - unless you are required to do this, (for legal reasons, for example) we'd recommend using a delete(Object) instead, to preserve the history of the entity.
      Returns:
      this
    • matchNotExists

      public Transaction.Builder matchNotExists(Object id)
      Adds a match operation to the transaction. Asserts that the given entity ID does not exist at validTime = now, otherwise the transaction will abort.
      Returns:
      this
    • match

      public Transaction.Builder match(XtdbDocument document)
      Adds a match operation to the transaction. Asserts that the given document is present at validTime = now, otherwise the transaction will abort.
      Returns:
      this
    • matchNotExists

      public Transaction.Builder matchNotExists(Object id, Date atValidTime)
      Adds a match operation to the transaction. Asserts that the given entity ID does not exist at the given validTime, otherwise the transaction will abort.
      Returns:
      this
    • match

      public Transaction.Builder match(XtdbDocument document, Date atValidTime)
      Adds a match operation to the transaction. Asserts that the given document is present at the given valid time, otherwise the transaction will abort.
      Returns:
      this
    • invokeFunction

      public Transaction.Builder invokeFunction(Object id, Object... arguments)
      Adds a transaction function invocation operation to the transaction. Invokes the transaction function with the given id, passing it the given arguments.
      Returns:
      this
    • withTxTime

      public Transaction.Builder withTxTime(Date txTime)
      Overrides the txTime of the transaction, for use in imports. Mustn't be older than any other transaction already submitted to XT, nor newer than the TxLog's clock.
      Parameters:
      txTime - overridden transaction time of this transaction.
      Returns:
      this
    • build

      public Transaction build()