trafficusage

package
v1.21.6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package trafficusage owns idempotent subscription usage accounting.

Index

Constants

View Source
const BucketConsumer = "subscription.traffic_bucket"

BucketConsumer is persisted in the inbox; changing it replays old usage.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

func New

func New(store Store) *Service

func (*Service) ApplyBucketOnce

func (s *Service) ApplyBucketOnce(ctx context.Context, bucket string, deltas []traffic.SubscribeTrafficDelta) error

ApplyBucketOnce commits usage and its inbox marker together. Network log retries can replay this operation without charging usage again.

type Store

type Store interface {
	Inbox() repository.InboxRepo
	InSubscriptionTx(context.Context, func(repository.SubscriptionStore) error) error
}

Jump to

Keyboard shortcuts

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