auditoutbox

package
v0.4.18 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package auditoutbox owns the SDK-private lease and fence mechanics for the public audit package's per-app table. Module authors use audit.Record and ms.DrainAudit; exposing this layer would invite competing drainers.

Index

Constants

This section is empty.

Variables

View Source
var ErrLeaseLost = errors.New("mirrorstack/audit: outbox lease was fenced")

ErrLeaseLost means a newer claim owns the row. A stale worker must not acknowledge, retry, or quarantine it.

Functions

func Acknowledge

func Acknowledge(ctx context.Context, q db.Querier, id int64, token string) error

Acknowledge marks a lease delivered only when its rotating token still owns the row.

func Quarantine

func Quarantine(ctx context.Context, q db.Querier, id int64, token, code string) error

Quarantine makes a permanently invalid or exhausted row terminal without deleting the evidence an operator needs to inspect it.

func Retry

func Retry(ctx context.Context, q db.Querier, id int64, token, code string, availableAt time.Time) error

Retry releases a lease at a bounded future time.

Types

type Delivery

type Delivery struct {
	ID          int64
	EventID     string
	OccurredAt  time.Time
	SubjectKind string
	SubjectID   string
	Action      string
	Details     json.RawMessage
	Proof       []byte
	Attempts    int
	LeaseToken  string
}

Delivery is one privately-provenanced outbox row leased for forwarding. Proof is exact canonical invocation JSON and must only be placed back into the platform invocation header; it must never be logged or exposed to module code.

func Claim

func Claim(ctx context.Context, q db.Querier, limit int, leaseUntil time.Time) ([]Delivery, error)

Claim leases the oldest ready rows with SKIP LOCKED. Expired claims are reclaimable and receive a new token, fencing the old worker.

Jump to

Keyboard shortcuts

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