pathteststore

package
v0.0.0-...-d5a6f8d Latest Latest
Warning

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

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

Documentation

Overview

Package pathteststore handle pathtest storage

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PathtestContext

type PathtestContext struct {
	Pathtest *common.Pathtest
	// contains filtered or unexported fields
}

PathtestContext contains Pathtest information and additional flush related data

func (*PathtestContext) LastFlushInterval

func (p *PathtestContext) LastFlushInterval() time.Duration

LastFlushInterval returns last flush interval

func (*PathtestContext) SetLastFlushInterval

func (p *PathtestContext) SetLastFlushInterval(lastFlushInterval time.Duration)

SetLastFlushInterval sets last flush interval

type Store

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

Store is used to accumulate aggregated contexts

func NewPathtestStore

func NewPathtestStore(pathtestTTL time.Duration, pathtestInterval time.Duration, contextsLimit int, logger log.Component) *Store

NewPathtestStore creates a new Store

func (*Store) Add

func (f *Store) Add(pathtestToAdd *common.Pathtest)

Add new pathtest

func (*Store) Flush

func (f *Store) Flush() []*PathtestContext

Flush will flush specific Pathtest context (distinct hash) if nextRun is reached once a Pathtest context is flushed nextRun will be updated to the next flush time

ttl: ttl defines the duration we should keep a specific PathtestContext in `Store.contexts` after `lastSuccessfulFlush`. // Flow context in `Store.contexts` map will be deleted if `ttl` is reached to avoid keeping Pathtest context that are not seen anymore. We need to keep PathtestContext (contains `nextRun` and `lastSuccessfulFlush`) after flush to be able to flush at regular interval (`flushInterval`). Example, after a flush, PathtestContext will have a new nextRun, that will be the next flush time for new contexts being added.

func (*Store) GetContextsCount

func (f *Store) GetContextsCount() int

GetContextsCount returns pathtest contexts count

Jump to

Keyboard shortcuts

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