Class TransactionConfig.Builder

java.lang.Object
io.permazen.core.TransactionConfig.Builder
All Implemented Interfaces:
Cloneable
Enclosing class:
TransactionConfig

public static final class TransactionConfig.Builder extends Object implements Cloneable
Builder for TransactionConfigs.
  • Method Details

    • schemaModel

      public TransactionConfig.Builder schemaModel(SchemaModel schemaModel)
      Configure the schema to use.

      By default this is null, which means that an empty schema will be used.

      Parameters:
      schemaModel - schema to use when creating transactions
      Returns:
      this instance
    • allowNewSchema

      public TransactionConfig.Builder allowNewSchema(boolean allowNewSchema)
      Configure whether, if the configured schema is not already registered in the database when new transactions are created, it is allowed to register it.

      The default value is true.

      Parameters:
      allowNewSchema - whether registering a new schema is allowed
      Returns:
      this instance
    • schemaRemoval

      public TransactionConfig.Builder schemaRemoval(TransactionConfig.SchemaRemoval schemaRemoval)
      Configure when to automatically detect and remove unused schemas from the database.

      When schema removal is enabled, unused schemas (i.e., those for which zero objects exist) are automatically detected and removed at the beginning certain transactions. This operation adds a small amount of overhead.

      The default value is TransactionConfig.SchemaRemoval.CONFIG_CHANGE.

      Parameters:
      schemaRemoval - if and when to automatically detect and remove unused schemas
      Returns:
      this instance
      Throws:
      IllegalArgumentException - if schemaRemoval is null
    • kvOptions

      public TransactionConfig.Builder kvOptions(Map<String,?> kvoptions)
      Configure KVDatabase transaction options.

      The default value is null.

      Parameters:
      kvoptions - options to use when creating new transactions in the underlying KVDatabase, or null for none
      Returns:
      this instance
      See Also:
    • build

      public TransactionConfig build()
      Create a new TransactionConfig from this instance.
      Returns:
      new transaction config
      Throws:
      InvalidSchemaException - if the configured schema is invalid (i.e., does not pass validation checks)
    • clone

      public TransactionConfig.Builder clone()
      Clone this instance.
      Overrides:
      clone in class Object
      Returns:
      clone of this instance