state

package
v0.0.0-...-7983b3b Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitCheckStateManager

func InitCheckStateManager()

InitCheckStateManager initialized the default implementation of the CheckStateAPI

Types

type CheckStateAPI

type CheckStateAPI interface {
	GetState(key string) (string, error)
	SetState(key, value string) error
	Clear()
}

CheckStateAPI contains all the functions for setting and getting state from disk / memory

func GetCheckStateManager

func GetCheckStateManager() CheckStateAPI

GetCheckStateManager returns a handle on the global check checkmanager Instance

type CheckStateManager

type CheckStateManager struct {
	Config Config
	Cache  *cache.Cache
}

CheckStateManager is the default implementation for the CheckStateAPI that read / writes state from / to disk

func NewCheckStateManager

func NewCheckStateManager() *CheckStateManager

NewCheckStateManager returns a pointer to an instance of CheckStateManager which implements the CheckStateAPI

func (*CheckStateManager) Clear

func (cs *CheckStateManager) Clear()

Clear removes all the elements in the CheckStateManager Cache

func (*CheckStateManager) GetState

func (cs *CheckStateManager) GetState(key string) (string, error)

GetState returns a value previously stored, or an error that occurred when trying to retrieve the state for a given key

func (*CheckStateManager) SetState

func (cs *CheckStateManager) SetState(key, value string) error

SetState stores data on disk in the config.StateRootPath directory

type Config

type Config struct {
	StateRootPath           string
	CacheExpirationDuration time.Duration
	CachePurgeDuration      time.Duration
}

Config contains all the configuration for the CheckState

func GetStateConfig

func GetStateConfig() Config

GetStateConfig returns the configuration for the CheckState

Jump to

Keyboard shortcuts

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