Class DittoConfig

java.lang.Object
com.ditto.java.DittoConfig

public final class DittoConfig extends Object
Configuration for creating a Ditto instance. Use DittoConfig.Builder to construct instances of this class.
  • Method Details

    • getDatabaseId

      public @NonNull String getDatabaseId()
      Returns the database ID for this configuration.
      Returns:
      the database ID string.
    • getConnect

      public @NonNull DittoConfig.Connect getConnect()
      Returns the connection configuration.
      Returns:
      the DittoConfig.Connect configuration specifying how Ditto connects to other peers.
    • getPersistenceDirectory

      public @Nullable File getPersistenceDirectory()
      Returns the persistence directory as a File object.
      Returns:
      the persistence directory File, or null if using the default directory.
    • getPersistenceDirectoryPath

      public @Nullable String getPersistenceDirectoryPath()
      Returns the persistence directory path as a string.
      Returns:
      the persistence directory path, or null if using the default directory.
    • getExperimental

      public @NonNull DittoConfig.Experimental getExperimental()
      Returns the experimental features configuration.
      Returns:
      the DittoConfig.Experimental configuration.
    • getSystemParameters

      public @NonNull Map<@NonNull String,@NonNull Object> getSystemParameters()

      Returns the system parameters applied when the Ditto instance opened.

      Non-negative integers are returned as Long when possible and BigInteger otherwise. Negative integers are Long, floating-point values are finite Double values, arrays are List values, and objects are string-keyed Map values.

      To inspect an effective value after opening Ditto, execute SHOW parameter_name and read the named field from the first DittoQueryResultItem.getValue() with a typed DittoCborSerializable accessor. The query result is a CBOR dictionary, not this configuration map.

      CompletionStage<Boolean> enabled = ditto.getStore().execute(
          "SHOW TOMBSTONE_TTL_ENABLED",
          result -> result.getItems().get(0).getValue().get("tombstone_ttl_enabled").asBoolean()
      );
      
    • withConnect

      public @NonNull DittoConfig withConnect(@NonNull DittoConfig.Connect connect)
      Creates a new DittoConfig with a different connection configuration.
      Parameters:
      connect - the new DittoConfig.Connect configuration.
      Returns:
      a new DittoConfig instance with the updated connection settings.
    • getDefault

      public static @NonNull DittoConfig getDefault()
      Returns the default DittoConfig instance.
      Returns:
      a default configuration suitable for most use cases.
    • getDefaultDatabaseId

      public static @NonNull String getDefaultDatabaseId()
      Returns the default database ID.
      Returns:
      the default database ID string.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object