chanmonitor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChanMonitor

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

ChanMonitor is monitor struce

func NewChanMonitor

func NewChanMonitor(threshold int) *ChanMonitor

NewChanMonitor return a new chanMonitor with threshold value adn default interval 10s

func NewChanMonitorWithInterval

func NewChanMonitorWithInterval(threshold int, interval int) *ChanMonitor

NewChanMonitorWithInterval return a new chanMonitor with threshold value and interval

func (*ChanMonitor) AddChan

func (cm *ChanMonitor) AddChan(channame string, c interface{}) error

AddChan is used to add a channel to monitor

func (*ChanMonitor) GetOverFlowSnapshot

func (cm *ChanMonitor) GetOverFlowSnapshot() []Chaninfo

GetOverFlowSnapshot get over flow snapshot

func (*ChanMonitor) GetSnapshot

func (cm *ChanMonitor) GetSnapshot() []Chaninfo

GetSnapshot get the snapshot of the chan monitor

func (*ChanMonitor) SnapshotToJSON

func (cm *ChanMonitor) SnapshotToJSON(snap []Chaninfo) ([]byte, error)

SnapshotToJSON make ChainInfo array to json format

func (*ChanMonitor) SnapshotToString

func (cm *ChanMonitor) SnapshotToString(snap []Chaninfo) []string

SnapshotToString make Chaninfo array to string array

func (*ChanMonitor) Stop

func (cm *ChanMonitor) Stop()

Stop the monitor

type Chaninfo

type Chaninfo struct {
	Len        int    `json:"len"`
	Cap        int    `json:"cap"`
	Percent    int    `json:"percent"`
	Name       string `json:"name"`
	IsOverflow bool   `json:"isOverflow"`
}

Jump to

Keyboard shortcuts

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