heartbeat

package
v0.0.0-...-f0983eb Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Heartbeat

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

Heartbeat is simple way to track heartbeats.

func New

func New(timeout time.Duration, timeoutFunc func()) *Heartbeat

New creates new Heartbeat with specified duration. timeoutFunc will be called if timeout for heartbeat is expired. Note that in case of timeout you need to call Beat() to reactivate Heartbeat.

func (*Heartbeat) Beat

func (hb *Heartbeat) Beat()

Beat resets internal timer to zero. It also can be used to reactivate Heartbeat after timeout.

func (*Heartbeat) Stop

func (hb *Heartbeat) Stop()

Stop stops Heartbeat timer.

func (*Heartbeat) Update

func (hb *Heartbeat) Update(d time.Duration)

Update updates internal timeout to d. It does not do Beat.

Jump to

Keyboard shortcuts

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