forwarder

package
v0.1.48 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Workers slice contains configuration for all workers
	Workers []*WorkerConfig
	// StateStoreIntervalSec the number of seconds between saving state calls
	StateStoreIntervalSec int
	// SyncWorkersIntervalSec the number of second between re-checking configurations (files)
	SyncWorkersIntervalSec int
	// ReloadFn the function which is called for re-load the config (Read from a file, for instance)
	ReloadFn func() (*Config, error) `json:"-"`
}

Config struct contains the comprehensive forwarder configuration. It describes workers, and some common parameters

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig creates a new instance of Config with default values

func (*Config) Apply

func (c *Config) Apply(other *Config)

Apply allows to overwrite existing values by the other config provided

func (*Config) Check

func (c *Config) Check() error

Check performs a parameter checks and returns an error if they are not acceptable

func (*Config) Equals

func (c *Config) Equals(other *Config) bool

Equals returns true if the Config c has same field values as other

func (*Config) Reload

func (c *Config) Reload() (bool, error)

Reload refresh and can update the Config c instance values

func (*Config) String

func (c *Config) String() string

type Forwarder

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

func NewForwarder

func NewForwarder(cfg *Config, cli api.Client, storage storage.Storage) (*Forwarder, error)

func (*Forwarder) Close

func (f *Forwarder) Close() error

func (*Forwarder) Run

func (f *Forwarder) Run(ctx context.Context) error

type PipeConfig

type PipeConfig struct {
	// Name contains name of pipe that
	Name string
	// From contains an expression for selecting partitions where records will be considered
	// The value could be empty - app partitions
	From string
	// Filter contains an expression for filtering records (true means record is taken).
	// The value could be empty - all records match
	Filter string
}

PipeConfig struct constains settings for filtering records from different partitions

func (*PipeConfig) Check

func (sc *PipeConfig) Check() error

func (*PipeConfig) String

func (sc *PipeConfig) String() string

String is fmt.Stringer implementation

type WorkerConfig

type WorkerConfig struct {
	// Name contains the name of the forwarding configuration
	Name string
	// Pipe describes the source, where records will be taken
	Pipe *PipeConfig
	// Sink describes the destination, where records will be written
	Sink *sink.Config
}

WorkerConfig struct sets up the name of forwarder, the source (Pipe) and the records destination (Sink)

func (*WorkerConfig) Check

func (wc *WorkerConfig) Check() error

Check performs an internal check for WorkerConfig fields

func (*WorkerConfig) String

func (wc *WorkerConfig) String() string

String is fmt.Stringer implementation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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