idtrack

package
v0.8.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Seen    time.Time `json:"seen"`
	Copied  time.Time `json:"copied"`
	Advised bool      `json:"advised,omitempty"`
	Size    float64   `json:"size"`
	Value   string    `json:"value,omitempty"`
}

type Tracker

type Tracker struct {
	Items map[string]*Item

	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, wg *sync.WaitGroup, interval time.Duration, warn time.Duration, sizeTrigger float64, stateFile string, stream string, worker string, replicator string, nc *nats.Conn, syncSubject string, log *logrus.Entry) (*Tracker, error)

func (*Tracker) NotifyAgeWarning

func (t *Tracker) NotifyAgeWarning(cb func(map[string]Item)) error

NotifyAgeWarning notifies a callback when an item exceeds the warning threshold, callbacks will be sent until RecordAdvised() is called for an item, which will reset on recovery

func (*Tracker) NotifyExpired

func (t *Tracker) NotifyExpired(cb func(map[string]Item)) error

NotifyExpired registers a callback for expired

func (*Tracker) NotifyFirstSeen

func (t *Tracker) NotifyFirstSeen(cb func(string, Item)) error

NotifyFirstSeen registers a callback for items that were seen for the first time

func (*Tracker) NotifyRecover

func (t *Tracker) NotifyRecover(cb func(string, Item)) error

NotifyRecover notifies a callback when an item that exceeded the warning threshold but not yet reached the expired threshold is seen again

func (*Tracker) RecordAdvised

func (t *Tracker) RecordAdvised(v string)

RecordAdvised records that we advised about the item

func (*Tracker) RecordCopied

func (t *Tracker) RecordCopied(v string)

RecordCopied records the fact the node data was copied, used to manage sampling

func (*Tracker) RecordSeen

func (t *Tracker) RecordSeen(v string, sz float64)

RecordSeen records that we saw the item

func (*Tracker) ShouldProcess

func (t *Tracker) ShouldProcess(v string, sz float64) bool

ShouldProcess determines if a message should be processed considering last seen times, size deltas and copied delta

Jump to

Keyboard shortcuts

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