state

package
v0.0.0-...-0269a1e Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IDFromContext

func IDFromContext(ctx context.Context) string

Types

type State

type State interface{}

type StateManager

type StateManager[S State] struct {
	// contains filtered or unexported fields
}

func NewStateManager

func NewStateManager[S State]() *StateManager[S]

func (*StateManager[S]) Close

func (sm *StateManager[S]) Close()

Close the StateManager, cleaning up the background worker. It should not be used after this call.

func (*StateManager[S]) Get

func (sm *StateManager[S]) Get(conID string) (S, bool)

Get a previously saved state for a connection ID. If the connection ID is not present in the map, a blank state will be returned

func (*StateManager[S]) Set

func (sm *StateManager[S]) Set(conID string, state S)

Set state for a connection ID. Previously saved state will be overriden.

Jump to

Keyboard shortcuts

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