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 ¶
func Get(ctx context.Context) *TransferAccounter
Get returns a *TransferAccounter from the ctx.
If none is found it will return a dummy one to keep the code simple.
func New ¶
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.