firebolt: github.com/digitalocean/firebolt Index | Files | Directories

package firebolt

import "github.com/digitalocean/firebolt"

Index

Package Files

error.go event.go helpers.go

type AsyncEvent Uses

type AsyncEvent struct {
    *Event
    ReturnError    func(error)
    ReturnEvent    func(*AsyncEvent)
    ReturnFiltered func()
}

AsyncEvent is a version of Event for nodes that support asynchronous processing.

func NewAsyncEvent Uses

func NewAsyncEvent(event *Event, errFunc func(error), eventFunc func(*AsyncEvent), filterFunc func()) *AsyncEvent

NewAsyncEvent creates a version of the passed Event suitable for asynchronous processing.

func (*AsyncEvent) WithPayload Uses

func (ae *AsyncEvent) WithPayload(payload interface{}) *AsyncEvent

WithPayload returns a clone of this event with the payload replaced.

type Event Uses

type Event struct {
    Payload  interface{} `json:"payload"`
    Created  time.Time   `json:"created"`
    Recovery bool        `json:"recovery"`
}

Event is the struct passed through the node graph.

func (*Event) WithPayload Uses

func (e *Event) WithPayload(payload interface{}) *Event

WithPayload returns a clone of this event with the payload replaced.

type EventError Uses

type EventError struct {
    Timestamp time.Time   `json:"timestamp"`
    Event     interface{} `json:"event"`
    Err       error       `json:"error"`
}

EventError is the structure passed to any `error_handler`. When an error occurs in a node that has an error_handler configured, firebolt wraps up the error and the causing event in an EventError. This EventError needs to be handled in your error_handler's Process() method.

func NewEventError Uses

func NewEventError(event *Event, err error) EventError

NewEventError constructs

func (EventError) MarshalJSON Uses

func (ee EventError) MarshalJSON() ([]byte, error)

MarshalJSON converts an EventError to json, replacing any err values that are not FBError with a FBError wrapper so that the generated JSON has consistent structure.

type FBError Uses

type FBError struct {
    Code      string      `json:"code"`
    Msg       string      `json:"message"`
    ErrorInfo interface{} `json:"errorinfo,omitempty"`
}

FBError is an optional error type that can be returned from the Process() method in your nodes,

func NewFBError Uses

func NewFBError(code string, msg string, opts ...FBErrorOpt) FBError

NewFBError constructs a firebolt error. Returning a FBError (rather than just 'error') from the Process() method in your nodes will result in more structured error reports if you use `error_handler` nodes.

func (FBError) Error Uses

func (f FBError) Error() string

type FBErrorOpt Uses

type FBErrorOpt func(FBError) FBError

FBErrorOpt is an option that allows you do add optional data to an FBError when calling the constructor.

func WithInfo Uses

func WithInfo(info interface{}) FBErrorOpt

WithInfo adds information to FBError.ErrorInfo.

type Nodeconfig Uses

type Nodeconfig map[string]string

Nodeconfig holds a Nodes configuration

func (Nodeconfig) IntConfig Uses

func (c Nodeconfig) IntConfig(name string, defaultValue int, minValue int, maxValue int) (int, error)

IntConfig validates and fetches the int-typed optional config value specified by 'name', using the 'defaultValue' if no value was provided in the configuration.

func (Nodeconfig) IntConfigRequired Uses

func (c Nodeconfig) IntConfigRequired(name string, minValue int, maxValue int) (int, error)

IntConfigRequired validates and fetches the int-typed required config value specified by 'name', returning an error if no value was provided in the configuration.

func (Nodeconfig) StringConfig Uses

func (c Nodeconfig) StringConfig(name string, defaultValue int) (string, error)

StringConfig validates and fetches the int-typed optional config value specified by 'name', using the 'defaultValue' if no value was provided in the configuration.

func (Nodeconfig) StringConfigRequired Uses

func (c Nodeconfig) StringConfigRequired(name string) (string, error)

StringConfigRequired validates and fetches the string-typed required config value specified by 'name', returning an error if no value was provided in the configuration.

Directories

PathSynopsis
config
examples
examples/kafkatokafka
examples/shared
executor
fbcontextCode generated by mockery v1.0.0.
internal
kafkaCode generated by mockery v1.0.0.
leader
message
metrics
node
node/elasticsearch
node/kafkaconsumer
node/kafkaproducerCode generated by mockery v1.0.0.
node/syslogparser
testutil
util

Package firebolt imports 4 packages (graph) and is imported by 10 packages. Updated 2020-01-05. Refresh now. Tools for package owners.