filter

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package filter configures and sets up a filter node

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

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

Filter is a struct that contains the configuration we are running with and the NATS bus connection

func StartFilter

func StartFilter(conf *config.Config) (_ *Filter, err error)

StartFilter creates a Filter instance, sets up its rules based on the configuration give and sets up a subscription for the incoming NATS subject.

func (*Filter) Stop

func (f *Filter) Stop()

Stop shuts down goroutines and closes resources related to the filter.

type Rule

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

Rule encapsulates a matching function and the NATS subject to send lines to if the rule matches.

func CreateBasicRule

func CreateBasicRule(measurement string, subject string) Rule

CreateBasicRule creates a simple rule that publishes measurements with the name @measurement to the NATS @subject.

func CreateNegativeRegexRule

func CreateNegativeRegexRule(regexString, subject string) Rule

CreateNegativeRegexRule creates a rule that publishes measurements which *don't* match the given @regexString to the NATS @subject.

func CreateRegexRule

func CreateRegexRule(regexString, subject string) Rule

CreateRegexRule creates a rule that publishes measurements which match the given @regexString to the NATS @subject.

func CreateTagRule

func CreateTagRule(tags influx.TagSet, subject string) Rule

CreateTagRule creates a rule that efficiently matches one or more measurement tags.

type RuleSet

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

RuleSet is a container for a number of Rules. Rules are kept in the order they were appended.

func RuleSetFromConfig

func RuleSetFromConfig(conf *config.Config) (*RuleSet, error)

RuleSetFromConfig creates a new RuleSet instance using the rules from Config provided.

func (*RuleSet) Append

func (rs *RuleSet) Append(rule Rule)

Append adds a rule to the end of a RuleSet.

func (*RuleSet) Count

func (rs *RuleSet) Count() int

Count returns the number of rules in the RuleSet.

func (*RuleSet) Lookup

func (rs *RuleSet) Lookup(escaped []byte) int

Lookup takes a raw line and returns the index of the rule in the RuleSet that matches it. Returns -1 if there was no match.

func (*RuleSet) LookupParsed

func (rs *RuleSet) LookupParsed(line *parsedLine) int

LookupParsed takes a parsedLine and checks for a matching rule in the RuleSet. The index of the matching rule is returned. Returns -1 if there was no match.

func (*RuleSet) Subjects

func (rs *RuleSet) Subjects() []string

Subjects returns NATS subjects of the rules in the RuleSet.

Jump to

Keyboard shortcuts

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