Documentation
¶
Overview ¶
Package idempotency replays client-token creates: a retry with the same token and parameters returns the resource the first call made.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrParamsMismatch = errors.New("client token was already used with different parameters")
ErrParamsMismatch is returned when a token is reused with different parameters.
Functions ¶
func Create ¶
func Create[T any]( m *Memo, op, token, fingerprint string, idOf func(*T) string, get func(string) (*T, error), create func() (*T, error), ) (*T, error)
Create returns the live resource recorded for (op, token) or runs create and records it. An empty token always runs create; a reused token with a different fingerprint yields ErrParamsMismatch.
func Fingerprint ¶
Fingerprint renders request parameters for comparison across retries.
Types ¶
type Memo ¶
type Memo struct {
// contains filtered or unexported fields
}
Memo remembers which resource a (op, token) created; bounded by TTL and entry cap.
Click to show internal directories.
Click to hide internal directories.