core

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPTransport

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

HTTPTransport implements transport interface for http/https protocol

func (*HTTPTransport) Init

func (ht *HTTPTransport) Init(url string, token string) error

Init creates a http client

func (*HTTPTransport) Transmit

func (ht *HTTPTransport) Transmit(topic string, data []byte) error

Transmit sends data with given topic that is used as url

type MQTTTransport

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

MQTTTransport implements transport interface for mqtt protocol

func (*MQTTTransport) Init

func (mt *MQTTTransport) Init(url string, token string) error

Init creates and connect mqtt client

func (*MQTTTransport) Transmit

func (mt *MQTTTransport) Transmit(topic string, data []byte) error

Transmit sends data on given mqtt topic

type Pick

type Pick func() interface{}

Pick is called in order to pickup a data for generate method

type Runner

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

Runner runs given generator in specific intervals

func NewRunner

func NewRunner(config RunnerConfig) (Runner, error)

NewRunner creates new runner

func (*Runner) Count

func (r *Runner) Count() int64

Count returns number of generated messages

func (*Runner) Run

func (r *Runner) Run()

Run runs the runner :joy:

func (*Runner) Stop

func (r *Runner) Stop()

Stop stops the runner

type RunnerConfig

type RunnerConfig struct {
	Generator generators.Generator
	Duration  time.Duration
	Pick      Pick
	Token     string
	URL       string
}

RunnerConfig contains runner configuration these configuration specifies host, rate and etc.

type Transport

type Transport interface {
	Init(url string, token string) error
	Transmit(topic string, data []byte) error
}

Transport transports data to given topic based its network protocol

Jump to

Keyboard shortcuts

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