Package com.tnsai.idempotency
Enum Class KeyStrategy
- All Implemented Interfaces:
Serializable,Comparable<KeyStrategy>,Constable
Strategy for deriving the idempotency key of a tool / action call
(issue #91).
- Since:
- 0.5.0 (issue #91)
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe tool supplies its own key viaidempotencyKeyFor(input).SHA-256 over canonical JSON of the call's input map.No idempotency protection.Fresh ULID per call. -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyStrategyReturns the enum constant of this class with the specified name.static KeyStrategy[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
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
The tool supplies its own key viaidempotencyKeyFor(input). Use when the natural key is a single field of the input (e.g. an upstream-providedrequest_id, or a normalizedtitle) and a hash-of-everything would over- or under-dedupe. -
UUID
Fresh ULID per call. The key is propagated to upstream services (HTTPIdempotency-Keyheader) 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
No idempotency protection. Default for actions / tools that are not annotated with@Idempotent.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-