mem

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v0.1.1

type Option func(s *StateStore)

func WithCapacity added in v0.1.1

func WithCapacity(capacity uint64) Option

WithCapacity configures the store to automatically expire states after ttl If left unconfigured, a default of 5 minutes will be used

func WithLogger added in v0.1.1

func WithLogger(logger *slog.Logger) Option

WithLogger configures the store with the given logger If left unconfigured, logging will be disabled

func WithTTL added in v0.1.1

func WithTTL(ttl time.Duration) Option

WithTTL configures the store to automatically expire states after ttl If left unconfigured, a default of 5 minutes will be used

type StateStore added in v0.1.1

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

StateStore is a StateStore using memory

func NewStateStore added in v0.1.1

func NewStateStore(opts ...Option) *StateStore

func (*StateStore) GetState added in v0.1.1

func (m *StateStore) GetState(key string) (*header.MachineInfo, error)

GetState returns the info assocated with key. If key is not in the store, the returned info will be nil

func (*StateStore) SetState added in v0.1.1

func (m *StateStore) SetState(key string, info *header.MachineInfo) error

SetState associates key with info in the store

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳