config

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPort is the default port number used by the SensorBee server.
	DefaultPort = 15601
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Network section has parameters related to the network such as listening
	// ports, timeouts, etc..
	Network *Network

	// Topologies section has information of topologies created on startup.
	// This section might be going to be removed when SensorBee supports
	// persisting topologies.
	Topologies Topologies

	// Storage section has information of storage of components in SensorBee.
	Storage *Storage

	// Logging section has parameters related to logging.
	Logging *Logging
}

Config is a root of configuration trees.

func New

func New(m data.Map) (*Config, error)

New creates a new config struct from JSON-style parameters.

func (*Config) ToMap

func (c *Config) ToMap() data.Map

ToMap returns server config information as data.Map.

type Logging

type Logging struct {
	// Target is a logging target. It can be one of followings:
	//
	//	- stdout
	//	- stderr
	//	- file path
	Target string `json:"target" yaml:"target"`

	// MinLogLevel specifies the minimum level of log entries which should
	// actually be written to the target. Possible levels are "debug", "info",
	// "warn"/"warning", "error", or "fatal".
	MinLogLevel string `json:"min_log_level" yaml:"min_log_level"`

	// LogDroppedTuples controls logging of dropped tuples. If this parameter
	// is true, dropped tuples are logged as JSON objects in logs. It might
	// affect the overall performance of the server.
	//
	// Setting this option true doesn't enable destinationless tuple logging.
	LogDroppedTuples bool `json:"log_dropped_tuples" yaml:"log_dropped_tuples"`

	// LogDestinationlessTuples controls logging of dropped tuples.
	// A destinationless tuple is a kind of dropped tuples that is generated
	// when a source or a stream does not have any destination and a tuple
	// emitted from it is dropped.
	//
	// To log destinationless tuples, both log_dropped_tuples and
	// log_destinationless_tuples need to be true.
	LogDestinationlessTuples bool `json:"log_destinationless_tuples" yaml:"log_destinationless_tuples"`

	// SummarizeDroppedTuples controls summarization of dropped tuples. If this
	// parameter is true, only a portion of a dropped tuple is logged. The data
	// logged looks like a JSON object but might not be able to be parsed by
	// JSON parsers. This parameter only works when LogDroppedTuples is true.
	SummarizeDroppedTuples bool `json:"summarize_dropped_tuples" yaml:"summarize_dropped_tuples"`
}

Logging has configuration parameters for logging.

func NewLogging

func NewLogging(m data.Map) (*Logging, error)

NewLogging create a Logging config parameters from a given map.

func (*Logging) CreateWriter

func (l *Logging) CreateWriter() (io.WriteCloser, error)

CreateWriter creates io.Writer for loggers. When Target is a file, the writer supports log rotation using lumberjack.

func (*Logging) ToMap

func (l *Logging) ToMap() data.Map

ToMap returns logging config information as data.Map.

type Network

type Network struct {
	// ListenOn has binding information in "host:port" format.
	ListenOn string `json:"listen_on" yaml:"listen_on"`
}

Network has configuration parameters related to the network.

func NewNetwork

func NewNetwork(m data.Map) (*Network, error)

NewNetwork creates a Newtork config parameters from a given map.

func (*Network) ToMap

func (n *Network) ToMap() data.Map

ToMap returns network config information as data.Map.

type Storage

type Storage struct {
	UDS UDSStorage `json:"uds" yaml:"uds"`
}

Storage has storage configuration parameters for components in SensorBee.

func NewStorage

func NewStorage(m data.Map) (*Storage, error)

NewStorage creates a Storage config parameters from a given map.

func (*Storage) ToMap

func (s *Storage) ToMap() data.Map

ToMap returns storage config information as data.Map.

type Topologies

type Topologies map[string]*Topology

Topologies is a set of configuration of topologies.

func NewTopologies

func NewTopologies(m data.Map) (Topologies, error)

NewTopologies creates a Topologies config parameters from a given map.

func (*Topologies) ToMap

func (ts *Topologies) ToMap() data.Map

ToMap returns topologies config information as data.Map.

type Topology

type Topology struct {
	// Name is the name of the topology. This field isn't directly used
	// in a config file.
	Name string `json:"-" yaml:"-"`

	// BQLFile is a file path to the BQL file executed on start up.
	BQLFile string `json:"bql_file" yaml:"bql_file"`
}

Topology has configuration parameters for a SensorBee topology.

type UDSStorage

type UDSStorage struct {
	Type   string   `json:"type" yaml:"params"`
	Params data.Map `json:"params" yaml:"params"`
}

UDSStorage has configuration parameters for the storage of UDSs.

Jump to

Keyboard shortcuts

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