usage

package
v0.1.0-rc.41 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package publicurlusageworker finishes and sends stored public URL usage reports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	WorkerID         string
	Endpoint         string
	Token            string
	HTTPClient       *http.Client
	Logger           *slog.Logger
	Observer         UsageObserver
	LeaseDuration    time.Duration
	OperationTimeout time.Duration
	PollInterval     time.Duration
	RetryInterval    time.Duration
}

type Store

type Store interface {
	MarkExpiredIngressUsageRunsIncomplete(context.Context, time.Time) (int, error)
	FinalizePublicURLUsageBuckets(context.Context, time.Time, time.Time) (int, error)
	ClaimPublicURLUsageDeliveries(context.Context, string, int, time.Time, time.Duration) ([]controlstate.PublicURLUsageDeliveryWork, error)
	CompletePublicURLUsageDelivery(context.Context, controlstate.PublicURLUsageDeliveryWork, time.Time) error
	RetryPublicURLUsageDelivery(context.Context, controlstate.PublicURLUsageDeliveryWork, time.Time, string, time.Time) error
	RejectPublicURLUsageDelivery(context.Context, controlstate.PublicURLUsageDeliveryWork, string, time.Time) error
}

Store is the stored public URL usage state used by a Worker.

type UsageObserver

type UsageObserver interface {
	ObserveUsageWork(phase string, outcome observability.UsageWorkOutcome)
	AddUsageItems(result string, count int)
	ObserveUsageReceiver(outcome observability.UsageReceiverOutcome, elapsed time.Duration)
}

type Worker

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

func New

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

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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