Enum Class KeyStrategy

java.lang.Object
java.lang.Enum<KeyStrategy>
com.tnsai.idempotency.KeyStrategy
All Implemented Interfaces:
Serializable, Comparable<KeyStrategy>, Constable

public enum KeyStrategy extends Enum<KeyStrategy>
Strategy for deriving the idempotency key of a tool / action call (issue #91).
Since:
0.5.0 (issue #91)
  • Enum Constant Details

    • HASH_INPUT

      public static final KeyStrategy HASH_INPUT
      SHA-256 over canonical JSON of the call's input map. Natural for pure-by-content operations: send_email(to, subject, body) with the same fields hashes to the same key, so the framework dedupes without the tool author writing extra code.
    • EXPLICIT

      public static final KeyStrategy EXPLICIT
      The tool supplies its own key via idempotencyKeyFor(input). Use when the natural key is a single field of the input (e.g. an upstream-provided request_id, or a normalized title) and a hash-of-everything would over- or under-dedupe.
    • UUID

      public static final KeyStrategy UUID
      Fresh ULID per call. The key is propagated to upstream services (HTTP Idempotency-Key header) but the framework performs no client-side dedup — useful when the upstream is the source of truth and the framework should not second-guess it.
    • NONE

      public static final KeyStrategy NONE
      No idempotency protection. Default for actions / tools that are not annotated with @Idempotent.
  • Method Details

    • values

      public static KeyStrategy[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static KeyStrategy valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null