table

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: BSD-2-Clause-Views Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface added in v1.2.1

type Interface interface {
	AddAggregator(agg *aggregator.Aggregator)
	AddRewriter(rw rewriter.RW)
	AddBlocklist(matcher *matcher.Matcher)
	AddRoute(route route.Route)
	DelRoute(key string) error
	UpdateDestination(key string, index int, opts map[string]string) error
	UpdateRoute(key string, opts map[string]string) error
	GetIn() chan []byte
	GetSpoolDir() string
}

Interface represents a table abstractly

type MockTable added in v1.2.1

type MockTable struct {
	Aggregators []*aggregator.Aggregator
	Rewriters   []rewriter.RW
	Blocklist   []*matcher.Matcher
	Routes      []route.Route
}

MockTable is used for tests

func (*MockTable) AddAggregator added in v1.2.1

func (m *MockTable) AddAggregator(agg *aggregator.Aggregator)

func (*MockTable) AddBlocklist added in v1.2.1

func (m *MockTable) AddBlocklist(matcher *matcher.Matcher)

func (*MockTable) AddRewriter added in v1.2.1

func (m *MockTable) AddRewriter(rw rewriter.RW)

func (*MockTable) AddRoute added in v1.2.1

func (m *MockTable) AddRoute(route route.Route)

func (*MockTable) DelRoute added in v1.2.1

func (m *MockTable) DelRoute(key string) error

func (*MockTable) GetIn added in v1.2.1

func (m *MockTable) GetIn() chan []byte

func (*MockTable) GetSpoolDir added in v1.2.1

func (m *MockTable) GetSpoolDir() string

func (*MockTable) UpdateDestination added in v1.2.1

func (m *MockTable) UpdateDestination(key string, index int, opts map[string]string) error

func (*MockTable) UpdateRoute added in v1.2.1

func (m *MockTable) UpdateRoute(key string, opts map[string]string) error

type Table

type Table struct {
	sync.Mutex // only needed for the multiple writers

	SpoolDir string

	In chan []byte `json:"-"` // channel api to trade in some performance for encapsulation, for aggregators
	// contains filtered or unexported fields
}

func New

func New(config TableConfig) *Table

func (*Table) AddAggregator

func (table *Table) AddAggregator(agg *aggregator.Aggregator)

func (*Table) AddBlocklist added in v1.2.1

func (table *Table) AddBlocklist(matcher *matcher.Matcher)

func (*Table) AddRewriter

func (table *Table) AddRewriter(rw rewriter.RW)

func (*Table) AddRoute

func (table *Table) AddRoute(route route.Route)

AddRoute adds a route to the table. The Route must be running already

func (*Table) Bad

func (table *Table) Bad() *badmetrics.BadMetrics

func (*Table) DelAggregator

func (table *Table) DelAggregator(id int) error

func (*Table) DelBlocklist added in v1.2.1

func (table *Table) DelBlocklist(index int) error

func (*Table) DelDestination

func (table *Table) DelDestination(key string, index int) error

func (*Table) DelRewriter

func (table *Table) DelRewriter(id int) error

func (*Table) DelRoute

func (table *Table) DelRoute(key string) error

idempotent semantics, not existing is fine

func (*Table) Dispatch

func (table *Table) Dispatch(buf []byte)

Dispatch is the entrypoint to send data into the table. it dispatches incoming metrics into matching aggregators and routes, after checking against the blocklist buf is assumed to have no whitespace at the end

func (*Table) DispatchAggregate

func (table *Table) DispatchAggregate(buf []byte)

DispatchAggregate dispatches aggregation output by routing metrics into the matching routes. buf is assumed to have no whitespace at the end

func (*Table) Flush

func (table *Table) Flush() error

func (*Table) GetIn

func (table *Table) GetIn() chan []byte

func (*Table) GetRoute

func (table *Table) GetRoute(key string) route.Route

func (*Table) GetSpoolDir

func (table *Table) GetSpoolDir() string

func (*Table) IncNumInvalid

func (table *Table) IncNumInvalid()

This is used by inputs to record invalid packets It also increments numIn so that it reflects the overall total

func (*Table) Print

func (table *Table) Print() (str string)

func (*Table) Shutdown

func (table *Table) Shutdown() error

func (*Table) Snapshot

func (table *Table) Snapshot() TableSnapshot

to view the state of the table/route at any point in time we might add more functions to view specific entries if the need for that appears

func (*Table) UpdateDestination

func (table *Table) UpdateDestination(key string, index int, opts map[string]string) error

func (*Table) UpdateRoute

func (table *Table) UpdateRoute(key string, opts map[string]string) error

type TableConfig

type TableConfig struct {
	SpoolDir                string
	BadMetricsMaxAge        time.Duration
	Validation_level_legacy validate.LevelLegacy
	Validation_level_m20    validate.LevelM20
	Validate_order          bool
	// contains filtered or unexported fields
}

func NewTableConfig added in v1.2.1

func NewTableConfig(spoolDir, badMetricsMaxAge string, vLegacy validate.LevelLegacy, vM20 validate.LevelM20, vOrder bool) (TableConfig, error)

type TableSnapshot

type TableSnapshot struct {
	Rewriters   []rewriter.RW            `json:"rewriters"`
	Aggregators []*aggregator.Aggregator `json:"aggregators"`
	Blocklist   []*matcher.Matcher       `json:"blocklist"`
	Routes      []route.Snapshot         `json:"routes"`
	SpoolDir    string
}

Jump to

Keyboard shortcuts

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