trafficagg

package
v1.15.23 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

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

func New

func New(deps Deps) *Aggregator

func (*Aggregator) AddReport

func (a *Aggregator) AddReport(ctx context.Context, serverInfo *node.Server, protocol string, logs []UserTraffic) error

func (*Aggregator) AddReportAt

func (a *Aggregator) AddReportAt(ctx context.Context, serverInfo *node.Server, protocol string, logs []UserTraffic, now time.Time) error

func (*Aggregator) FlushDueBuckets

func (a *Aggregator) FlushDueBuckets(ctx context.Context, now time.Time) error

func (*Aggregator) FlushServerReports

func (a *Aggregator) FlushServerReports(ctx context.Context) error

type Deps added in v1.15.0

type Deps struct {
	Store repository.Store
	Redis *redis.Client
	// TrafficReportThreshold reads the runtime-mutable minimum report size;
	// nil means no minimum.
	TrafficReportThreshold func() int64
	// Multiplier returns the node traffic multiplier in effect at the given
	// time; nil means no multiplier is configured.
	Multiplier func(at time.Time) float32
}

Deps declares the aggregator's collaborators; callers build it from their own composition (the queue logic and the network module both use it).

type UserTraffic

type UserTraffic struct {
	SID      int64
	Upload   int64
	Download int64
}

Jump to

Keyboard shortcuts

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