subr

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//SubrPrefix = "[SUBR]"
	InfoPrefix    = "INFO"
	WarningPrefix = "WARN"
	ErrorPrefix   = "ERRR"
)
View Source
const (
	Faster = FetchFrequency(20 * time.Second)
	Fast   = FetchFrequency(1 * time.Minute)
	Normal = FetchFrequency(5 * time.Minute)
	Slow   = FetchFrequency(20 * time.Minute)
	Slower = FetchFrequency(1 * time.Hour)
)

Variables

This section is empty.

Functions

func CastBucketToBytes

func CastBucketToBytes(buckets map[string]interface{}, key string) (data []byte, err error)

func GetColoredText

func GetColoredText(text string, textColor string) string

Types

type Comparator

type Comparator interface {
	Compare(c *Context) (fresh bool, err error)
}

type CompareFunc

type CompareFunc func(c *Context) (fresh bool, err error)

type Consolidator

type Consolidator interface {
	Consolidate(c *Context) error
}

type Context

type Context struct {
	*Logger

	StartTimestamp time.Time
	Buckets        map[string]interface{}
	LastBuckets    map[string]interface{}
}

type Dispatcher

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

func Default

func Default() *Dispatcher

func New

func New() *Dispatcher

func (*Dispatcher) AttachInstance

func (d *Dispatcher) AttachInstance(id InstanceID, instance *Instance) error

func (*Dispatcher) GetInstance

func (d *Dispatcher) GetInstance(id InstanceID) *Instance

func (*Dispatcher) Run

func (d *Dispatcher) Run()

type FetchFrequency

type FetchFrequency time.Duration

type Fetcher

type Fetcher interface {
	Fetch(c *Context) error
}

type Instance

type Instance struct {
	FetchFrequency
	LastBuckets map[string]interface{}
	// contains filtered or unexported fields
}

func NewInstance

func NewInstance(frequency FetchFrequency) *Instance

func (*Instance) Execute

func (i *Instance) Execute()

func (*Instance) SetComparator

func (i *Instance) SetComparator(comparator Comparator) *Instance

func (*Instance) UseConsolidator

func (i *Instance) UseConsolidator(consolidator Consolidator) *Instance

func (*Instance) UseFetcher

func (i *Instance) UseFetcher(fetcher Fetcher) *Instance

func (*Instance) UseTranspiler

func (i *Instance) UseTranspiler(transpiler Transpiler) *Instance

type InstanceID

type InstanceID string

type Logger

type Logger struct {
	InstanceID
}

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

func (*Logger) Errorln

func (l *Logger) Errorln(v ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

func (*Logger) Infoln

func (l *Logger) Infoln(v ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...interface{})

func (*Logger) Warnln

func (l *Logger) Warnln(v ...interface{})

type TranspileFunc

type TranspileFunc func(c *Context) error

type FetchFunc func(c *Context) error

type Transpiler

type Transpiler interface {
	Transpile(c *Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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