collator

package
v0.0.0-...-c71c7b6 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	InAlertState         bool
	AverageHitsPerSecond float64
	Time                 time.Time
}

An Alert notifies the listener of high traffic, and also when traffic returns to a normal level

type ByHits

type ByHits []Site

ByHits implements sort.Interface for []SizeHite, based on the number of hits

func (ByHits) Len

func (a ByHits) Len() int

func (ByHits) Less

func (a ByHits) Less(i, j int) bool

func (ByHits) Swap

func (a ByHits) Swap(i, j int)

type Collator

type Collator struct {
	ErrorChan  chan error
	SitesChan  chan *Sites
	StatusChan chan *Status
	AlertChan  chan *Alert
	ResetChan  chan bool
	// contains filtered or unexported fields
}

func NewAndRun

func NewAndRun(ctx context.Context, filename string, alertThreshold int) (*Collator, error)

Create a new Collator and start running its goroutines. The caller can stop the Collator by calling the CancelFunc in the passed-in context.

type Site

type Site struct {
	TotalHits int
	Site      string
}

type Sites

type Sites struct {
	Sites []Site
}

The Sites object lists the # of hits per site, and are sent less often (every 10 seconds)

type Status

type Status struct {
	HitsLastSecond       int
	AverageHitsPerSecond float64
}

These Status objects are sent frequently (one per second)

Jump to

Keyboard shortcuts

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