downloadmetrics

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0, AGPL-3.0 Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package downloadmetrics accounts for unique authenticated content over one download.

Index

Constants

View Source
const MaximumIntervals = 4096

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

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

Metrics outlives protocol generations. Its bounded interval ledger rejects duplicate/retried credit without retaining content or evicting old identities.

func New

func New(id string, now func() time.Time, directUsable bool) *Metrics

func Prepare

func Prepare(now func() time.Time) *Metrics

Prepare observes prewarming without starting the download clock.

func (*Metrics) Activate

func (m *Metrics) Activate(id string)

Activate is the content admission boundary, after local output preparation.

func (*Metrics) Availability

func (m *Metrics) Availability(direct bool)

Availability accepts only authenticated admitted direct-lane authority.

func (*Metrics) Delivered

func (m *Metrics) Delivered(revision string, start, end uint64, route Route)

func (*Metrics) EvidenceLost

func (m *Metrics) EvidenceLost()

func (*Metrics) Pending

func (m *Metrics) Pending() func()

Pending brackets transport waits; callers must release it before yielding to output, user pauses, or local capacity work.

func (*Metrics) Snapshot

func (m *Metrics) Snapshot(final bool) Snapshot

type Route

type Route uint8
const (
	Unknown Route = iota
	Direct
	TURN
	ApplicationRelay
)

type Snapshot

type Snapshot struct {
	DownloadID            string
	FirstDirectElapsed    *time.Duration
	DirectBytes           uint64
	TURNBytes             uint64
	ApplicationRelayBytes uint64
	UnknownBytes          uint64
	DirectFraction        *float64
	FallbackStall         time.Duration
	Incomplete            bool
	Final                 bool
}

Jump to

Keyboard shortcuts

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