Documentation ¶
Overview ¶
Package go4data has failures that ca nbe sent by Processors to either logging or just stdout etc
Package go4data is a package that is used to create procescors that runs any kind of handler on a payload flow The payloads will be transferred between processors that has a relationship assigned
Index ¶
- Variables
- func NewID() uint
- func PrintFailure(f Failure)
- func Save(path string, data interface{}) error
- type Failure
- type LoaderHandler
- type LoaderProccessor
- type Processor
- func (p *Processor) AddTopics(topics ...string) error
- func (p *Processor) ConvertToLoader() *LoaderProccessor
- func (p *Processor) GetConfiguration() *property.Configuration
- func (p *Processor) HandleSubscriptionless(ctx context.Context)
- func (p *Processor) MonitorErrChannel(ctx context.Context)
- func (p *Processor) SetHandler(a handlers.Handler)
- func (p *Processor) SetID(i uint)
- func (p *Processor) SetName(n string)
- func (p *Processor) Start(ctx context.Context) error
- func (p *Processor) Stop() error
- func (p *Processor) Subscribe(topics ...string) error
Constants ¶
This section is empty.
Variables ¶
var ( //IDCounter is used to make sure no processors are generated with a ID that already exists IDCounter uint = 1 // DefaultQueueSize is a limit set to define how many payloads can be sent in queue DefaultQueueSize = 1000 //ErrProcessorHasNoHandlerApplied is when starting a processor that has a nil Handler ErrProcessorHasNoHandlerApplied = errors.New("the processor has no Handler set. Please assign a Handler to it before running") //ErrNilContext not allowed ErrNilContext = errors.New("nil context is not allowed when starting a processor") //ErrProcessorAlreadyStopped is when trying to stop a processor that is alrady stopped ErrProcessorAlreadyStopped = errors.New("the processor is already stopped") //ErrRequiredPropertiesNotFulfilled is when trying to start a Handler but it needs additional properties ErrRequiredPropertiesNotFulfilled = errors.New("the Handler needs additional properties to work, see the Handlers documentation") //ErrHandlerDoesNotAcceptPublishers is when trying to register an publisher to a processor that has a selfpublishing Handler ErrHandlerDoesNotAcceptPublishers = errors.New("the used Handler does not allow publishers") //ErrDuplicateTopic is when trying to register an duplicate TOPIC to publish to ErrDuplicateTopic = errors.New("the topic is already registered") // ErrFailedToUnmarshal is thrown when trying to unmarshal go4datas but it fails ErrFailedToUnmarshal = errors.New("failed to unmarshal since data provided is not correct") )
var ( //ErrIngressRelationshipNeeded is when a processor isn't getting the needed ingress ErrIngressRelationshipNeeded = errors.New("the processor needs an ingress to properly run") )
Functions ¶
Types ¶
type Failure ¶
type Failure struct { // Err is the error that occurred Err error `json:"error"` // Payload is the payload that was being processed when a Failure occurred Payload payload.Payload `json:"payload"` // Processor is the UUID of the procesor that triggers the Error Processor uint `json:"processor"` }
Failure is the go4datas Custom error handeling struct It contains Error and some meta data about what Processor that triggerd the error
type LoaderHandler ¶
type LoaderHandler struct { Cfg *property.Configuration `json:"configs" yaml:"configs"` Name string `json:"handler" yaml:"handler_name"` }
LoaderHandler is a Handler thats easier to save/load
type LoaderProccessor ¶
type LoaderProccessor struct { // ID is a unique identifier for each processor, ID uint `json:"id" yaml:"id"` // Name is a user configured Name for a processor that can be used relatd to an Processor easier than an ID, cannot be duplicate tho // It will be changed to be duplicates later, but for now PrometheusMetrics crashes. Name string `json:"name" yaml:"name"` // Running is a boolean indicator if the processor is currently Running Running bool `json:"running" yaml:"running"` // Workers is a int that represents how many concurrent handlers to run Workers int `json:"workers" yaml:"workers"` // Topics is the Topics to publish payload onto Topics []string `json:"topics" yaml:"topics"` // Subscriptions is the Topics to subscribe to Subscriptions []string `json:"subscriptions" yaml:"subscriptions"` // QueueSize is a integer of how many payloads are accepted on the Output channels to Subscribers QueueSize int `json:"queuesize" yaml:"queuesize"` // LoaderHandler is a Handler that can be loaded/saved Handler LoaderHandler `json:"loaderhandler" yaml:"handler"` }
LoaderProccessor is used to load/save processors
func (*LoaderProccessor) ConvertToProcessor ¶
func (la *LoaderProccessor) ConvertToProcessor() (*Processor, error)
ConvertToProcessor is used to convert a Loader back into a Processor thats Runnable.
type Processor ¶
type Processor struct { // ID is a unique identifier for each processor, ID uint `json:"id" yaml:"id"` // Name is a user configured Name for a processor that can be used relatd to an Processor easier than an ID Name string `json:"name" yaml:"name"` // Running is a boolean indicator if the processor is currently Running Running bool `json:"running" yaml:"running"` // Workers is a int that determines how many Concurrent workers the processor should run Workers int `json:"workers yaml:"workers"` // FailureHandler is the failurehandler to use with the Processor FailureHandler func(f Failure) `json:"-" yaml:"-"` // Handler is the handler to Perform on the Payload received Handler handlers.Handler `json:"handler" yaml:"handler"` // Topics is the Topics to publish payload onto Topics []string `json:"topics" yaml:"topics"` // QueueSize is a integer of how many payloads are accepted on the Output channels to Subscribers QueueSize int `json:"queuesize" yaml:"queuesize"` // Metric is used to store metrics Metric metric.Provider `json:"-" yaml:"-"` sync.Mutex `json:"-" yaml:"-"` // contains filtered or unexported fields }
Processor is used to perform an Handler on each Item that is ingressed
func NewProcessor ¶
NewProcessor is used to spawn a new processor You need to set a registered Handler or it will return an error Topics is a vararg that allows you to insert any topic you want the processor to publish its payloads to
func (*Processor) ConvertToLoader ¶
func (p *Processor) ConvertToLoader() *LoaderProccessor
ConvertToLoader is actually just a way too convert into a savable format
func (*Processor) GetConfiguration ¶
func (p *Processor) GetConfiguration() *property.Configuration
GetConfiguration is just an reacher for Handlers getcfg
func (*Processor) HandleSubscriptionless ¶
HandleSubscriptionless is used to handle Handlers that has no requirement of subscriptions
func (*Processor) MonitorErrChannel ¶
MonitorErrChannel is used to monitor errorchannel of a handler if its not nil
func (*Processor) SetHandler ¶
SetHandler will change the Handler the Processor performs on incomming payloads Should hot reloading like this be ok? Do we need to Stop / Start the proccessor after?
func (*Processor) SetID ¶
SetID is a way to overwrite the generated ID, this is mostly used when Loading Processors from a Daisy file
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
redisEngine
package runner tool to run go4data files
|
package runner tool to run go4data files |
databases
Package databases is generated by Handlergenerator tooling Make sure to insert real Description here
|
Package databases is generated by Handlergenerator tooling Make sure to insert real Description here |
files
Package files is generated by Handlergenerator tooling Make sure to insert real Description here Package files is generated by Handlergenerator tooling Make sure to insert real Description here Package files is generated by Handlergenerator tooling This Handler is used to print Payloads onto a file
|
Package files is generated by Handlergenerator tooling Make sure to insert real Description here Package files is generated by Handlergenerator tooling Make sure to insert real Description here Package files is generated by Handlergenerator tooling This Handler is used to print Payloads onto a file |
filters
Package filters contains all there is to the Filterable interface.
|
Package filters contains all there is to the Filterable interface. |
network
Package network is generated by Handlergenerator tooling Make sure to insert real Description here Package network is generated by Handlergenerator tooling OpenPcap will open up a pcap and output all network packets to the next processor
|
Package network is generated by Handlergenerator tooling Make sure to insert real Description here Package network is generated by Handlergenerator tooling OpenPcap will open up a pcap and output all network packets to the next processor |
parsers
Package parsers is generated by Handlergenerator tooling Make sure to insert real Description here
|
Package parsers is generated by Handlergenerator tooling Make sure to insert real Description here |
terminal
Package terminal is generated by Handlergenerator tooling Make sure to insert real Description here Package terminal contains Handlers related to STDOUT
|
Package terminal is generated by Handlergenerator tooling Make sure to insert real Description here Package terminal contains Handlers related to STDOUT |
Package payload contains Structs that fulfills payload interface Package payload contains all the payload related stuff Payload is used to hold data between Processors, Payload is just an interface so each Processor could create its own Struct to handle data as long as it fulfills our interface
|
Package payload contains Structs that fulfills payload interface Package payload contains all the payload related stuff Payload is used to hold data between Processors, Payload is just an interface so each Processor could create its own Struct to handle data as long as it fulfills our interface |
Package pubsub contains defaultEngine is the default built-in Channel based engine used to pubsub
|
Package pubsub contains defaultEngine is the default built-in Channel based engine used to pubsub |
tooling
|
|
handlergenerator
This tool is used to generate a new Handler and test file It will generate a basic struct based on the super simple template
|
This tool is used to generate a new Handler and test file It will generate a basic struct based on the super simple template |
runner
package runner tool to run go4data files
|
package runner tool to run go4data files |