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
    • garbageCollectSchemas

      public TransactionConfig.Builder garbageCollectSchemas(boolean garbageCollectSchemas)
      Configure whether automatic schema garbage collection should be enabled.

      When automatic schema garbage collection is enabled, unused schemas are garbage collected at the start of each transaction. This adds a small amount of overhead to transaction startup, but only when a new schema set is encountered.

      The default value is false.

      Parameters:
      garbageCollectSchemas - whether to enable automatic schema garbage collection
      Returns:
      this instance
    • 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