Record Class CortexProperties.Restore

java.lang.Object
java.lang.Record
ai.chatur.cortex.spring.CortexProperties.Restore
Record Components:
enabled - whether the latest backup is restored at startup
keyPrefix - the S3 key prefix backups were uploaded under; only objects beneath it are considered, and the most recent is restored
Enclosing class:
CortexProperties

public static record CortexProperties.Restore(boolean enabled, String keyPrefix) extends Record
Settings for the restore-on-startup step auto-configured by CortexRestoreAutoConfiguration.

Disabled by default. When enabled, the latest backup under keyPrefix is downloaded and loaded into the assertions store during startup, before the application serves traffic — treating S3 as the source of truth and the local store as replaceable. It is a wipe-and-load that runs on every boot, so it requires CortexProperties.persistent() to be true and an enabled, configured CortexProperties.S3 client, exactly as backups do; the same software.amazon.awssdk:s3 and software.amazon.awssdk:apache-client dependencies must be on the classpath. A bucket with no backup yet is not an error — a first-ever deployment starts empty.

The switch is independent of CortexProperties.Backup.enabled(): an instance may restore without scheduling backups of its own (a replica seeded from another's uploads) or take backups without restoring. Because the two are independent, keyPrefix is configured here rather than read from CortexProperties.Backup.keyPrefix(); it defaults to the same cortex/, so an instance that both backs up and restores works with no extra configuration, but if cortex.backup.key-prefix is customized then cortex.restore.key-prefix must be set to match for the restore to find the uploads.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Restore(boolean enabled, String keyPrefix)
    Creates an instance of a Restore record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the enabled record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the keyPrefix record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Restore

      public Restore(@DefaultValue("false") boolean enabled, @DefaultValue("cortex/") String keyPrefix)
      Creates an instance of a Restore record class.
      Parameters:
      enabled - the value for the enabled record component
      keyPrefix - the value for the keyPrefix record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • enabled

      public boolean enabled()
      Returns the value of the enabled record component.
      Returns:
      the value of the enabled record component
    • keyPrefix

      public String keyPrefix()
      Returns the value of the keyPrefix record component.
      Returns:
      the value of the keyPrefix record component