auditrelay

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package auditrelay delivers metadata-side management audit outbox events.

Index

Constants

View Source
const (
	DefaultBatchSize = 100
	DefaultLease     = 2 * time.Minute
)

Variables

This section is empty.

Functions

func Backoff

func Backoff(attempts int) time.Duration

Backoff returns the bounded retry delay after an event's current attempt count.

Types

type Audit

type Audit interface {
	AppendBatch(context.Context, []model.AuditLog) ([]model.AuditLog, error)
	FindByEventUUIDs(context.Context, []string) ([]model.AuditLog, error)
}

type Observer

type Observer interface {
	SetOutboxPending(int, time.Duration)
}

type Outbox

type Outbox interface {
	ClaimBatch(context.Context, string, int, time.Duration) ([]model.ManagementAuditOutbox, error)
	MarkDelivered(context.Context, string) error
	MarkFailed(context.Context, string, string, time.Duration) error
	PendingStats(context.Context) (int, time.Duration, error)
}

type Relay

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

func New

func New(outbox Outbox, audit Audit, workerID string, observer Observer) (*Relay, error)

func (*Relay) Run

func (relay *Relay) Run(ctx context.Context, interval time.Duration) error

func (*Relay) RunOnce

func (relay *Relay) RunOnce(ctx context.Context) (int, error)

RunOnce claims and attempts one atomic audit append. On a failed or unknown outcome it reconciles by event UUID before updating each outbox row.

Jump to

Keyboard shortcuts

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