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 ¶
StartFilter creates a Filter instance, sets up its rules based on the configuration give and sets up a subscription for the incoming NATS subject.
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 ¶
CreateBasicRule creates a simple rule that publishes measurements with the name @measurement to the NATS @subject.
func CreateNegativeRegexRule ¶
CreateNegativeRegexRule creates a rule that publishes measurements which *don't* match the given @regexString to the NATS @subject.
func CreateRegexRule ¶
CreateRegexRule creates a rule that publishes measurements which match the given @regexString to the NATS @subject.
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 ¶
RuleSetFromConfig creates a new RuleSet instance using the rules from Config provided.
func (*RuleSet) Lookup ¶
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 ¶
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.