Versions in this module Expand all Collapse all v1 v1.0.0 Aug 26, 2026 Changes in this version + const MaxFingerprintVersionBytes + const MaxKeyPartBytes + const MaxLease + const MaxMetadataEntries + const MaxMetadataKeyBytes + const MaxMetadataValueBytes + const MaxOwnerTokenBytes + const MaxResultBytes + func WithOwnership(ctx context.Context, ownership Ownership) context.Context + type AcquireRequest struct + Fingerprint Fingerprint + Key Key + Lease time.Duration + type AcquireResult struct + Outcome Outcome + Record Record + type AvailabilityPolicy uint8 + const AvailabilityAllowUntracked + const AvailabilityFailClosed + type BeginRequest struct + Acquire AcquireRequest + Availability AvailabilityPolicy + type BeginResult struct + Durable bool + Execute bool + Failure error + Outcome Outcome + Record Record + type CompleteRequest struct + Metadata map[string]string + Ownership Ownership + Result []byte + type Error struct + Cause error + Field string + Reason Reason + func (e *Error) Error() string + func (e *Error) Unwrap() error + type FailRequest struct + Metadata map[string]string + Ownership Ownership + Result []byte + type Fingerprint struct + func NewFingerprint(version string, canonical []byte) (Fingerprint, error) + func NewFingerprintFromSum(version string, sum []byte) (Fingerprint, error) + func (f Fingerprint) Equal(other Fingerprint) bool + func (f Fingerprint) Sum() []byte + func (f Fingerprint) Version() string + type HeartbeatRequest struct + Lease time.Duration + Ownership Ownership + type Key struct + func NewKey(namespace, tenant, operation, caller, value string) (Key, error) + func (k Key) Caller() string + func (k Key) Namespace() string + func (k Key) Operation() string + func (k Key) Tenant() string + func (k Key) Value() string + type KeyHasher func(Key) string + func NewHMACKeyHasher(secret []byte) (KeyHasher, error) + type Observation struct + Correlation string + Durable bool + Outcome Outcome + Reason Reason + Transition Transition + type Observer interface + Observe func(context.Context, Observation) + type ObserverFunc func(context.Context, Observation) + func (f ObserverFunc) Observe(ctx context.Context, observation Observation) + type Outcome string + const OutcomeAcquired + const OutcomeConflict + const OutcomeInProgress + const OutcomeReplayed + const OutcomeStaleOwnerTakeover + const OutcomeTerminalFailure + const OutcomeUnavailable + type Ownership struct + FencingToken uint64 + Key Key + OwnerToken string + func OwnershipFromContext(ctx context.Context) (Ownership, bool) + type Reason string + const ReasonInvalidConfiguration + const ReasonInvalidFingerprint + const ReasonInvalidKey + const ReasonInvalidLease + const ReasonInvalidPayload + const ReasonInvalidTransition + const ReasonLeaseExpired + const ReasonLimitExceeded + const ReasonNotFound + const ReasonStaleOwner + const ReasonUnavailable + const ReasonUnsafeBackend + type Record struct + AbandonedAt time.Time + Attempt uint64 + CompletedAt time.Time + CreatedAt time.Time + ExpiredAt time.Time + FailedAt time.Time + FencingToken uint64 + Fingerprint Fingerprint + HeartbeatAt time.Time + Key Key + LeaseExpiresAt time.Time + Metadata map[string]string + OwnerToken string + Result []byte + State State + UpdatedAt time.Time + func (r Record) Ownership() Ownership + type Service struct + func NewService(store Store) (*Service, error) + func NewServiceWithOptions(store Store, options ServiceOptions) (*Service, error) + func (s *Service) Begin(ctx context.Context, request BeginRequest) (result BeginResult, err error) + func (s *Service) Complete(ctx context.Context, request CompleteRequest) (record Record, err error) + func (s *Service) Expire(ctx context.Context, key Key) (record Record, err error) + func (s *Service) Fail(ctx context.Context, request FailRequest) (record Record, err error) + func (s *Service) Heartbeat(ctx context.Context, request HeartbeatRequest) (record Record, err error) + func (s *Service) Inspect(ctx context.Context, key Key) (record Record, err error) + func (s *Service) Release(ctx context.Context, ownership Ownership) (record Record, err error) + type ServiceOptions struct + KeyHasher KeyHasher + Observer Observer + type State string + const StateAbandoned + const StateAcquired + const StateCompleted + const StateExpired + const StateFailed + const StateRunning + type Store interface + Acquire func(context.Context, AcquireRequest) (AcquireResult, error) + Complete func(context.Context, CompleteRequest) (Record, error) + Expire func(context.Context, Key) (Record, error) + Fail func(context.Context, FailRequest) (Record, error) + Heartbeat func(context.Context, HeartbeatRequest) (Record, error) + Inspect func(context.Context, Key) (Record, error) + Release func(context.Context, Ownership) (Record, error) + type Transition string + const TransitionAcquire + const TransitionComplete + const TransitionExpire + const TransitionFail + const TransitionHeartbeat + const TransitionInspect + const TransitionRelease