core

package
v2.0.6+incompatible Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: Apache-2.0 Imports: 8 Imported by: 48

Documentation

Index

Constants

View Source
const DefaultDelay = 1 * time.Second

DefaultDelay is the default delay for an ExpBackoff structure when it is not specified, or when it is zero (in which case this becomes the delay after the first immediate retry)

View Source
const LogCourierVersion string = "2.0.6"

LogCourierVersion is the library version number

Variables

This section is empty.

Functions

func CalculateRunningAverage

func CalculateRunningAverage(period float64, totalPeriods float64, average float64, measurement float64) float64

CalculateRunningAverage returns a running average On the first call, where the existing average is 0, it will return the measurement unchanged

func CalculateSpeed

func CalculateSpeed(duration time.Duration, average float64, measurement float64, secondsNoChange *int) float64

CalculateSpeed returns a running average for a speed using variable time periods over 5 seconds. If all measurements are 0 in a 5 second period it will auto-reset

Types

type Event

type Event map[string]interface{}

Event holds a key-value map that represents a single log event

func (Event) Encode

func (e Event) Encode() ([]byte, error)

Encode returns the Event in JSON format

type EventDescriptor

type EventDescriptor struct {
	Stream Stream
	Offset int64
	Event  []byte
}

EventDescriptor describes an Event, such as it's source and offset, which can be used in order to resume log files

type ExpBackoff

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

ExpBackoff implements an exponential backoff helper The default delay is 1 second

func NewExpBackoff

func NewExpBackoff(name string, defaultDelay time.Duration, maxDelay time.Duration) *ExpBackoff

NewExpBackoff creates a new ExpBackoff structure with the given default delay

func (*ExpBackoff) Reset

func (e *ExpBackoff) Reset()

Reset resets the exponential backoff to default values

func (*ExpBackoff) Trigger

func (e *ExpBackoff) Trigger() time.Duration

Trigger informs the ExpBackoff that backoff needs to happen and returns the next delay to use

type IPipelineConfigReceiver

type IPipelineConfigReceiver interface {
	// contains filtered or unexported methods
}

type IPipelineSegment

type IPipelineSegment interface {
	Run()
	// contains filtered or unexported methods
}

type Pipeline

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

func NewPipeline

func NewPipeline() *Pipeline

func (*Pipeline) Register

func (p *Pipeline) Register(ipipe IPipelineSegment)

func (*Pipeline) SendConfig

func (p *Pipeline) SendConfig(config *config.Config)

func (*Pipeline) Shutdown

func (p *Pipeline) Shutdown()

func (*Pipeline) Start

func (p *Pipeline) Start()

func (*Pipeline) Wait

func (p *Pipeline) Wait()

type PipelineConfigReceiver

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

func (*PipelineConfigReceiver) OnConfig

func (s *PipelineConfigReceiver) OnConfig() <-chan *config.Config

type PipelineSegment

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

func (*PipelineSegment) Done

func (s *PipelineSegment) Done()

func (*PipelineSegment) OnShutdown

func (s *PipelineSegment) OnShutdown() <-chan interface{}

func (*PipelineSegment) Run

func (s *PipelineSegment) Run()

type Snapshot

type Snapshot struct {
	Desc    string
	Entries map[string]interface{}
	Keys    []string
	Subs    map[string]*Snapshot
	SubKeys []string
}

func NewSnapshot

func NewSnapshot(desc string) *Snapshot

func (*Snapshot) AddEntry

func (s *Snapshot) AddEntry(name string, value interface{})

func (*Snapshot) AddSub

func (s *Snapshot) AddSub(sub *Snapshot)

func (*Snapshot) Description

func (s *Snapshot) Description() string

func (*Snapshot) Entry

func (s *Snapshot) Entry(i int) (string, interface{})

func (*Snapshot) EntryByName

func (s *Snapshot) EntryByName(name string) (interface{}, bool)

func (*Snapshot) NumEntries

func (s *Snapshot) NumEntries() int

func (*Snapshot) NumSubs

func (s *Snapshot) NumSubs() int

func (*Snapshot) Sort

func (s *Snapshot) Sort()

func (*Snapshot) Sub

func (s *Snapshot) Sub(i int) *Snapshot

type Stream

type Stream interface {
	Info() (string, os.FileInfo)
}

A stream should be a pointer object that uniquely identified a file stream

Jump to

Keyboard shortcuts

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