counter

package
v0.0.0-...-c475b33 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: MIT Imports: 3 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

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

A Counter is a thread-safe counter implementation

func (*Counter) Incr

func (c *Counter) Incr(val int64)

Incr method increments the counter by some value

func (*Counter) Reset

func (c *Counter) Reset()

Reset -

type RateCounter

type RateCounter struct {
	Reader   *Counter
	Writer   *Counter
	Callback func(int64, int64)
}

RateCounter -

func NewRateCounter

func NewRateCounter(cb func(int64, int64)) *RateCounter

NewRateCounter -

func (*RateCounter) Run

func (cc *RateCounter) Run() *RateCounter

Run -

type Reader

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

Reader counts the bytes read through it.

func NewReader

func NewReader(r io.Reader, c *RateCounter) *Reader

NewReader makes a new Reader that counts the bytes read through it.

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

type Writter

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

Writter -

func NewWritter

func NewWritter(w io.WriteCloser, c *RateCounter) *Writter

NewWritter -

func (*Writter) Close

func (w *Writter) Close() error

Close -

func (*Writter) Write

func (w *Writter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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