webhookidempotency

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package webhookidempotency adapts idempotency leases to webhook replay checks.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidConfig = errors.New("webhook/idempotency: invalid configuration")
	ErrInvalidExpiry = errors.New("webhook/idempotency: expiry must be in the future")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Service   *idempotency.Service
	Namespace string
	Tenant    string
	Operation string
	Caller    string
	Clock     func() time.Time
}

Config supplies the durable service and full collision scope.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements webhook.ReplayStore with fail-closed durable leases.

func New

func New(config Config) (*Store, error)

New validates the durable service and every key scope component.

func (*Store) CheckAndRecord

func (s *Store) CheckAndRecord(ctx context.Context, value string, expiresAt time.Time) (bool, error)

CheckAndRecord acquires a lease through idempotency. Acquired and stale takeover outcomes are new records; every retained matching outcome is a replay. Backend unavailability remains an error through fail-closed mode.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL