core

package
v0.0.0-...-e915dfe Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

type Aggregator struct {
	sync.Mutex

	EventBus chan models.Event
	StateBus chan models.SensorState
	ErrorBus chan error
	// contains filtered or unexported fields
}

func NewAggregator

func NewAggregator(conf *Config) *Aggregator

func (*Aggregator) Start

func (r *Aggregator) Start(geoLocate bool) (err error)

type Config

type Config struct {
	NodeName string    `yaml:"name"`
	Debug    bool      `yaml:"debug"`
	Database Database  `yaml:"database"`
	Reporter *Reporter `yaml:"reports"`
	Twitter  *Twitter  `yaml:"twitter"`
	Sensors  []*Sensor `yaml:"sensors"`
}

func Load

func Load(filename string) (*Config, error)

type Database

type Database struct {
	URL        string `yaml:"url"`
	GeoIP      string `yaml:"geoip"`
	PeriodSecs int    `yaml:"period"`
}

type Parser

type Parser struct {
	DatetimeFormat string         `yaml:"datetime_format"`
	Expression     string         `yaml:"expression"`
	Tokens         map[string]int `yaml:"tokens"`
	// contains filtered or unexported fields
}

func (*Parser) Compile

func (p *Parser) Compile() (err error)

func (*Parser) Parse

func (p *Parser) Parse(line string) (matched bool, tokens Tokens)

type Reporter

type Reporter struct {
	sync.Mutex

	Enabled    bool       `yaml:"enabled"`
	PeriodSecs int        `yaml:"period"`
	Repository repository `yaml:"repository"`
	// contains filtered or unexported fields
}

func (*Reporter) Init

func (r *Reporter) Init() (err error)

func (*Reporter) OnBatch

func (r *Reporter) OnBatch(events []models.Event) (reportURL string, err error)

type Rule

type Rule struct {
	Name        string `yaml:"name"`
	Token       string `yaml:"token"`
	Description string `yaml:"description"`
	Expression  string `yaml:"expression"`
	// contains filtered or unexported fields
}

func (*Rule) Compile

func (r *Rule) Compile() (err error)

func (*Rule) Match

func (r *Rule) Match(tokens Tokens) (matched bool, value string)

type Sensor

type Sensor struct {
	Name       string  `yaml:"name"`
	Enabled    bool    `yaml:"enabled"`
	Filename   string  `yaml:"filename"`
	PeriodSecs int     `yaml:"period"`
	Parser     *Parser `yaml:"parser"`
	Rules      []*Rule `yaml:"rules"`
	// contains filtered or unexported fields
}

func (*Sensor) Compile

func (s *Sensor) Compile() error

func (*Sensor) Start

func (s *Sensor) Start(events chan models.Event, errors chan error, states chan models.SensorState, state int64)

type Tokens

type Tokens map[string]string

type Twitter

type Twitter struct {
	sync.Mutex

	Enabled        bool   `yaml:"enabled"`
	ConsumerKey    string `yaml:"consumer_key"`
	ConsumerSecret string `yaml:"consumer_secret"`
	AccessKey      string `yaml:"access_key"`
	AccessSecret   string `yaml:"access_secret"`
	// contains filtered or unexported fields
}

func (*Twitter) Init

func (t *Twitter) Init() (err error)

func (*Twitter) OnBatch

func (t *Twitter) OnBatch(events []models.Event, reportURL string)

Jump to

Keyboard shortcuts

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