transferaccounter

package
v1.74.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package transferaccounter provides utilities for accounting server side transfers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TransferAccounter

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

TransferAccounter is used to account server side and other transfers.

func Get

Get returns a *TransferAccounter from the ctx.

If none is found it will return a dummy one to keep the code simple.

func New

func New(ctx context.Context, add func(n int64)) (context.Context, *TransferAccounter)

New creates a TransferAccounter using the add function passed in.

Note that the add function should be goroutine safe.

It adds the new TransferAccounter to the context.

func (*TransferAccounter) Add

func (ta *TransferAccounter) Add(n int64)

Add n bytes to the transfer

func (*TransferAccounter) Reset

func (ta *TransferAccounter) Reset()

Reset reverses out all accounted stats if Started() has been called

func (*TransferAccounter) Start

func (ta *TransferAccounter) Start()

Start the transfer. Call this before calling Add().

func (*TransferAccounter) Started

func (ta *TransferAccounter) Started() bool

Started returns if the transfer has had Start() called or not.

Jump to

Keyboard shortcuts

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