state

package
v0.0.0-...-cef08ef Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

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