probation

package
v0.0.0-...-aeb2987 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackFn

type CallbackFn func(clientID string, clientData interface{}) error

CallbackFn will be executed for every client that gets expired in the probation list.

type Probation

type Probation interface {
	// Add adds a client to the probation list.
	Add(clientID string, clientData interface{}, updateIfExists bool) error
	// Remove removes a client from the probation list.
	Remove(clientID string) error
	// Exists checks if a client is already in the probation list
	Exists(clientID string) bool
	// Start starts monitoring the probationList with the configured
	// probationTimeout
	Start() error
}

Probation is an interface that defines a set of APIs to manage a probation list. The probation list is guarded by a configurable timeout. Any clients that stay in the probation list after the probation timeout will be passed on to the registered ProbationCallback fn

func NewProbationManager

func NewProbationManager(
	name string,
	probationTimeout time.Duration,
	pcf CallbackFn,
) Probation

NewProbationManager returns the default implementation of Probation interface It takes in a name to be associated with this probation manager and a ProbationCallbackFn

Jump to

Keyboard shortcuts

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