filters

package
v0.0.0-...-4214274 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package filters contains all there is to the Filterable interface. This is a interface that Payload types can inccorporate so that they can pass through this filter function

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrNotFilterablePayload is thrown when the input payload does not fulfill filterable
	ErrNotFilterablePayload error = errors.New("The input payload is not filterable")
)

Functions

func NewFilterHandler

func NewFilterHandler() handlers.Handler

NewFilterHandler generates a new Filter Handler

Types

type FilterHandler

type FilterHandler struct {
	// Cfg is values needed to properly run the Handle func
	Cfg  *property.Configuration `json:"configs" yaml:"configs"`
	Name string                  `json:"name" yaml:"handler_name"`

	// MetricPayloadOut is how many payloads the processor has outputted
	MetricPayloadOut string
	// MetricPayloadIn is how many payloads the processor has inputted
	MetricPayloadIn string
	// contains filtered or unexported fields
}

FilterHandler is used to filter out payloads that contains the wanted values

func (*FilterHandler) GetConfiguration

func (a *FilterHandler) GetConfiguration() *property.Configuration

GetConfiguration will return the CFG for the Handler

func (*FilterHandler) GetErrorChannel

func (a *FilterHandler) GetErrorChannel() chan error

GetErrorChannel will return a channel that the Handler can output eventual errors onto

func (*FilterHandler) GetHandlerName

func (a *FilterHandler) GetHandlerName() string

GetHandlerName is used to retrun a unqiue string name

func (*FilterHandler) Handle

func (a *FilterHandler) Handle(ctx context.Context, input payload.Payload, topics ...string) error

Handle is used to check if payload is of Filterable type, then apply Filter to it

func (*FilterHandler) SetMetricProvider

func (a *FilterHandler) SetMetricProvider(p metric.Provider, prefix string) error

SetMetricProvider is used to change what metrics provider is used by the handler

func (*FilterHandler) Subscriptionless

func (a *FilterHandler) Subscriptionless() bool

Subscriptionless will return true/false if the Handler is genereating payloads itself

func (*FilterHandler) ValidateConfiguration

func (a *FilterHandler) ValidateConfiguration() (bool, []string)

ValidateConfiguration is used to see that all needed configurations are assigned before starting

Jump to

Keyboard shortcuts

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