Interface Transaction

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
RecordContextTransaction, RecordStoreAndRecordContextTransaction

public interface Transaction extends AutoCloseable
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
     
    void
     
    Optional<com.apple.foundationdb.relational.api.metadata.SchemaTemplate>
    Retrieves an `Optional` containing the bound schema template, if one exists.
    boolean
     
    void
    setBoundSchemaTemplate(com.apple.foundationdb.relational.api.metadata.SchemaTemplate schemaTemplate)
    Sets, or replaces the bound schema template.
    default <T> T
    unwrap(Class<? extends T> type)
    Unwraps this instance as type T, if such a cast is possible.
  • Method Details

    • commit

      void commit() throws com.apple.foundationdb.relational.api.exceptions.RelationalException
      Throws:
      com.apple.foundationdb.relational.api.exceptions.RelationalException
    • abort

      void abort() throws com.apple.foundationdb.relational.api.exceptions.RelationalException
      Throws:
      com.apple.foundationdb.relational.api.exceptions.RelationalException
    • getBoundSchemaTemplateMaybe

      @Nonnull Optional<com.apple.foundationdb.relational.api.metadata.SchemaTemplate> getBoundSchemaTemplateMaybe()
      Retrieves an `Optional` containing the bound schema template, if one exists.
      This method allows access to the schema template that has been bound to this Transaction. If no schema template is currently bound, an empty Optional is returned.
      Returns:
      An Optional containing the bound SchemaTemplate, or an empty Optional if no template is bound.
    • setBoundSchemaTemplate

      void setBoundSchemaTemplate(@Nonnull com.apple.foundationdb.relational.api.metadata.SchemaTemplate schemaTemplate)
      Sets, or replaces the bound schema template.
      This method binds the provided SchemaTemplate to this Transaction, any subsequent operation that requires interaction with the metadata, within the scope of this Transaction will use the bound SchemaTemplate from now on.
      if there is already a SchemaTemplate bound to this transaction, it will be replaced by the provided SchemaTemplate argument.
      Parameters:
      schemaTemplate - The SchemaTemplate to bind. Must not be null.
    • close

      void close() throws com.apple.foundationdb.relational.api.exceptions.RelationalException
      Specified by:
      close in interface AutoCloseable
      Throws:
      com.apple.foundationdb.relational.api.exceptions.RelationalException
    • isClosed

      boolean isClosed()
    • unwrap

      @Nonnull default <T> T unwrap(@Nonnull Class<? extends T> type) throws com.apple.foundationdb.relational.api.exceptions.InternalErrorException
      Unwraps this instance as type T, if such a cast is possible. This provides a convenient API for unwrapping implementation calls from the interface (to avoid lots of instanceof checks everywhere).
      Type Parameters:
      T - the generic type
      Parameters:
      type - the type to unwrap it as.
      Returns:
      this instance, as an instanceof Type T
      Throws:
      com.apple.foundationdb.relational.api.exceptions.InternalErrorException - if instance types are incompatible