elasticsearch

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package elasticsearch contains logic to record data to an elasticsearch index. The data is already sanitised by the data provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint_  string `mapstructure:"endpoint"`
	Timeout_   string `mapstructure:"timeout"`
	Backoff_   int    `mapstructure:"backoff"`
	IndexName_ string `mapstructure:"index_name"`
	// contains filtered or unexported fields
}

Config holds the necessary configuration for setting up an elasticsearch reader endpoint.

func FromViper

func FromViper(v *viper.Viper, name, key string) (*Config, error)

FromViper constructs the necessary configuration for bootstrapping the elasticsearch reader

func NewConfig

func NewConfig(name string, log logrus.FieldLogger, endpoint string, timeout time.Duration, backoff int, indexName string) (*Config, error)

func (*Config) Backoff

func (c *Config) Backoff() int

func (*Config) Endpoint

func (c *Config) Endpoint() string

func (*Config) IndexName

func (c *Config) IndexName() string

func (*Config) Logger

func (c *Config) Logger() logrus.FieldLogger

func (*Config) Name

func (c *Config) Name() string

func (*Config) NewInstance

func (c *Config) NewInstance(ctx context.Context, payloadChan chan *recorder.RecordJob) (recorder.DataRecorder, error)

func (*Config) RoutePath

func (c *Config) RoutePath() string

func (*Config) Timeout

func (c *Config) Timeout() time.Duration

type Recorder

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

Recorder contains an elasticsearch client and an indexname for recording data It implements DataRecorder interface

func NewRecorder

func NewRecorder(ctx context.Context, log logrus.FieldLogger, payloadChan chan *recorder.RecordJob, name, endpoint, indexName string, timeout time.Duration) (*Recorder, error)

NewRecorder returns an error if it can't create the index

func (*Recorder) IndexName added in v0.1.1

func (r *Recorder) IndexName() string

IndexName is the index/database

func (*Recorder) Name

func (r *Recorder) Name() string

Name shows the name identifier for this reader

func (*Recorder) PayloadChan

func (r *Recorder) PayloadChan() chan *recorder.RecordJob

PayloadChan returns the channel it receives the information from

func (*Recorder) Start

func (r *Recorder) Start(ctx context.Context) <-chan struct{}

Start begins reading from the target in its own goroutine It will close the done channel when the job channel is closed

func (*Recorder) Timeout added in v0.1.1

func (r *Recorder) Timeout() time.Duration

Timeout returns the timeout

Jump to

Keyboard shortcuts

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