synccounters

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const CNTLENGTH = 500

CNTLENGTH is the standard container capacity

Variables

View Source
var (
	ErrParent    = errors.New("parent is nil, child is closed")
	ErrContainer = errors.New("couldn't delete counter_child in container")
)

Functions

This section is empty.

Types

type ConnCounter

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

ConnCounter is a linked counter for a connection

func NewConnCounter

func NewConnCounter(parent *ContractCounter) *ConnCounter

NewConnCounter returns a new counter for a connection

func (*ConnCounter) Add

func (cc *ConnCounter) Add(i uint64) error

Add to parent value

func (*ConnCounter) Close

func (cc *ConnCounter) Close() (err error)

Close counter, sum inner value to parent and self-destruct

func (*ConnCounter) Inner

func (cc *ConnCounter) Inner() (*uint64, *uint64)

Inner Counters

func (*ConnCounter) Reset

func (cc *ConnCounter) Reset() uint64

Reset inner value

func (*ConnCounter) Sum

func (cc *ConnCounter) Sum() uint64

Sum to inner value and child values

type ContractCounter

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

ContractCounter contains the accumulated for an entire contract

func NewContractCounter

func NewContractCounter() *ContractCounter

NewContractCounter returns new traffic counter per contract

func (*ContractCounter) Add

func (ctc *ContractCounter) Add(i uint64)

Add to inner value

func (*ContractCounter) NewChild

func (ctc *ContractCounter) NewChild() *ConnCounter

NewChild linked to the ContractCounter

func (*ContractCounter) Reset

func (ctc *ContractCounter) Reset() uint64

Reset inner and child values

func (*ContractCounter) Sum

func (ctc *ContractCounter) Sum() uint64

Sum to inner value and child values

Jump to

Keyboard shortcuts

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