memory

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddResult

func AddResult(ss *core.EndpointStatus, result *core.Result)

AddResult adds a Result to EndpointStatus.Results and makes sure that there are no more than MaximumNumberOfResults results in the Results slice

func ShallowCopyEndpointStatus added in v3.3.0

func ShallowCopyEndpointStatus(ss *core.EndpointStatus, params *paging.EndpointStatusParams) *core.EndpointStatus

ShallowCopyEndpointStatus returns a shallow copy of a EndpointStatus with only the results within the range defined by the page and pageSize parameters

Types

type Store

type Store struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Store that leverages gocache

func NewStore

func NewStore(file string) (*Store, error)

NewStore creates a new store using gocache.Cache

This store holds everything in memory, and if the file parameter is not blank, supports eventual persistence.

func (*Store) Clear

func (s *Store) Clear()

Clear deletes everything from the store

func (*Store) Close

func (s *Store) Close()

Close does nothing, because there's nothing to close

func (*Store) DeleteAllEndpointStatusesNotInKeys added in v3.3.0

func (s *Store) DeleteAllEndpointStatusesNotInKeys(keys []string) int

DeleteAllEndpointStatusesNotInKeys removes all EndpointStatus that are not within the keys provided

func (*Store) GetAllEndpointStatuses added in v3.3.0

func (s *Store) GetAllEndpointStatuses(params *paging.EndpointStatusParams) ([]*core.EndpointStatus, error)

GetAllEndpointStatuses returns all monitored core.EndpointStatus with a subset of core.Result defined by the page and pageSize parameters

func (*Store) GetAverageResponseTimeByKey

func (s *Store) GetAverageResponseTimeByKey(key string, from, to time.Time) (int, error)

GetAverageResponseTimeByKey returns the average response time in milliseconds (value) during a time range

func (*Store) GetEndpointStatus added in v3.3.0

func (s *Store) GetEndpointStatus(groupName, endpointName string, params *paging.EndpointStatusParams) (*core.EndpointStatus, error)

GetEndpointStatus returns the endpoint status for a given endpoint name in the given group

func (*Store) GetEndpointStatusByKey added in v3.3.0

func (s *Store) GetEndpointStatusByKey(key string, params *paging.EndpointStatusParams) (*core.EndpointStatus, error)

GetEndpointStatusByKey returns the endpoint status for a given key

func (*Store) GetHourlyAverageResponseTimeByKey

func (s *Store) GetHourlyAverageResponseTimeByKey(key string, from, to time.Time) (map[int64]int, error)

GetHourlyAverageResponseTimeByKey returns a map of hourly (key) average response time in milliseconds (value) during a time range

func (*Store) GetUptimeByKey

func (s *Store) GetUptimeByKey(key string, from, to time.Time) (float64, error)

GetUptimeByKey returns the uptime percentage during a time range

func (*Store) Insert

func (s *Store) Insert(endpoint *core.Endpoint, result *core.Result) error

Insert adds the observed result for the specified endpoint into the store

func (*Store) Save

func (s *Store) Save() error

Save persists the cache to the store file

Jump to

Keyboard shortcuts

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