Categorygithub.com/sfomuseum/go-timings
modulepackage
1.4.0
Repository: https://github.com/sfomuseum/go-timings.git
Documentation: pkg.go.dev

# README

go-timings

Go package implementing interface and methods for background timing monitors

Documentation

Go Reference

Exmaple

import (
       "context"
       "github.com/sfomuseum/go-timings"
       "os"       
)

func main() {

	ctx := context.Background()
	
	monitor, _ := timings.NewMonitor(ctx, "counter://PT60S")

	monitor.Start(ctx, os.Stderr)
	defer monitor.Stop(ctx)

	monitor.Signal(ctx)	// increments by 1
}

# Functions

NewCounterMonitor creates a new `CounterMonitor` instance that will dispatch notifications using a time.Ticker configured by 'uri' which is expected to take the form of: counter://?duration={ISO8601_DURATION} Where {ISO8601_DURATION} is a valid ISO8601 duration string.
NewMonitor returns a new `Monitor` instance configured by 'uri'.
NewNullMonitor() creates a new `NullMonitor` which does nothing.
NewSinceMonitor creates a new `SinceMonitor` instance that will dispatch notifications using a time.Ticker configured by 'uri' which is expected to take the form of: since://.
RegisterMonitor registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `Monitor` instances by the `NewMonitor` method.
Schemes returns the list of schemes that have been registered.

# Constants

No description provided by the author
No description provided by the author

# Structs

type CounterMonitor implements the `Monitor` interface providing a background timings mechanism that tracks incrementing events.
type NullMonitor implements the `Monitor` interface but does nothing.
type SinceMonitor implements the `Monitor` interface providing a background timings mechanism that tracks the duration of time between events.
SinceResponse is a struct containing information related to a "since" timing event.

# Interfaces

type Monitor provides a common interface for timings-based monitors.

# Type aliases

MonitorInitializationFunc is a function defined by individual monitor package and used to create an instance of that monitor.
No description provided by the author