throttle

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ThrottledEventListener added in v1.15.1

type ThrottledEventListener interface {
	WhenThrottled()
}

type ThrottledEventRecorder added in v1.15.1

type ThrottledEventRecorder struct {
}

uses the event api to record that video was throttled at a particular time.

func (ThrottledEventRecorder) WhenThrottled added in v1.15.1

func (er ThrottledEventRecorder) WhenThrottled()

type ThrottledRecorder

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

ThrottledRecorder wraps a standard recorder so that it stops recording (ie gets throttled) if requested to record too often. This is desirable as the extra recordings are likely to be highly similar to the earlier recordings and contain no new information. It can happen when an animal is stuck in a trap or it is very windy.

func NewThrottledRecorder

func NewThrottledRecorder(
	baseRecorder recorder.Recorder,
	config *ThrottlerConfig,
	minSeconds int,
	eventListener ThrottledEventListener,
) *ThrottledRecorder

func NewThrottledRecorderWithClock added in v1.20.0

func NewThrottledRecorderWithClock(
	baseRecorder recorder.Recorder,
	config *ThrottlerConfig,
	minSeconds int,
	listener ThrottledEventListener,
	clock ratelimit.Clock,
) *ThrottledRecorder

func (*ThrottledRecorder) CheckCanRecord

func (throttler *ThrottledRecorder) CheckCanRecord() error

func (*ThrottledRecorder) StartRecording

func (throttler *ThrottledRecorder) StartRecording() error

func (*ThrottledRecorder) StopRecording

func (throttler *ThrottledRecorder) StopRecording() error

func (*ThrottledRecorder) WriteFrame

func (throttler *ThrottledRecorder) WriteFrame(frame *lepton3.Frame) error

type ThrottlerConfig

type ThrottlerConfig struct {
	ApplyThrottling bool          `yaml:"apply-throttling"`
	BucketSize      time.Duration `yaml:"bucket-size"`
	MinRefill       time.Duration `yaml:"min-refill"`
}

func DefaultThrottlerConfig

func DefaultThrottlerConfig() ThrottlerConfig

Jump to

Keyboard shortcuts

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