watcher

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultInterval = time.Second * 1
	// Azure promises tag index consistency within "seconds"
	DefaultHorizon = time.Minute
)

Variables

This section is empty.

Functions

func ConfigDefaults

func ConfigDefaults(cfg *WatchConfig) error

Types

type LogTail

type LogTail struct {
	Tenant string
	Path   string
	Number uint32
	Ext    string
	LastID string
}

LogTail records the newest (highest numbered) massif path in a log It is used to represent both the most recent massif log blob, and the most recent massif seal blob

func NewLogTail

func NewLogTail(path string) (LogTail, error)

NewLogTail parses the log tail information from path and returns a LogTail

func (*LogTail) TryReplacePath

func (l *LogTail) TryReplacePath(path string) bool

TryReplacePath considers if the other path is more recent. If it is, it replaces the values on the current tail with those parsed from other and returns true. Returns false if other is older than the tail.

func (*LogTail) TryReplaceTail

func (l *LogTail) TryReplaceTail(other LogTail) bool

TryReplaceTail considers if the other tail is more recent If it is, it replaces the values on the current tail with those copied from other and returns true. Returns false if other is older than the tail.

type LogTailCollator

type LogTailCollator struct {
	Massifs map[string]LogTail
	Seals   map[string]LogTail
}

LogTailCollator is used to collate the most recently modified massif blob paths for all tenants in a given time horizon

func NewLogTailCollator

func NewLogTailCollator() LogTailCollator

NewLogTailCollator creates a log tail collator

func (*LogTailCollator) CollatePage

func (c *LogTailCollator) CollatePage(page []*azblob.FilterBlobItem) error

CollatePage process a single page of azure blob filter results and collates the most recent LogTail's for each tenant represented in the page.

func (LogTailCollator) MassifTenants added in v0.0.3

func (c LogTailCollator) MassifTenants() []string

MassifTenants returns the keys of the massifs map specifically shuffled to avoid biasing service based on lexical order of tenant identities or go lang default key ordering

func (LogTailCollator) SealedTenants added in v0.0.3

func (c LogTailCollator) SealedTenants() []string

SealedTenants returns the keys of the seals map specifically shuffled to avoid biasing service based on lexical order of tenant identities or go lang default key ordering

func (LogTailCollator) SortedMassifTenants

func (c LogTailCollator) SortedMassifTenants() []string

SortedMassifTenants returns the keys of the massifs map in sorted order

func (LogTailCollator) SortedSealedTenants

func (c LogTailCollator) SortedSealedTenants() []string

SortedSealedTenants returns the keys of the massifs map in sorted order

type WatchConfig

type WatchConfig struct {
	Since         time.Time
	IDSince       string
	Horizon       time.Duration
	Interval      time.Duration
	IntervalCount int
}

type Watcher

type Watcher struct {
	Cfg WatchConfig
	// these are just for reporting for now
	LastSince   time.Time
	LastIDSince string
}

func NewWatcher

func NewWatcher(cfg WatchConfig) (Watcher, error)

func (Watcher) ConfigString added in v0.0.2

func (w Watcher) ConfigString() string

func (*Watcher) FirstFilter

func (w *Watcher) FirstFilter() string

func (*Watcher) NextFilter

func (w *Watcher) NextFilter() string

Jump to

Keyboard shortcuts

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