profile

package
v2.0.0-...-3280c16 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package profile provides types used to configure the Gakisitor and its plugins.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyAccessPath   = errors.New("empty access path")
	ErrInvalidAccessPath = errors.New("invalid access path")
	ErrInvalidIndexType  = errors.New("invalid index path type (must be a string or an int)")
	ErrOutOfBoundIndex   = errors.New("out of bound index path")
)

Errors which can be occur in AccessTo function.

Functions

This section is empty.

Types

type Plugin

type Plugin struct {
	Name   string `json:"name"`   // plugin name
	Path   string `json:"path"`   // plugin library path
	Config Raw    `json:"config"` // plugin configuration
}

Plugin describes the plugin profile.

func (*Plugin) AccessTo

func (profile *Plugin) AccessTo(paths ...interface{}) (interface{}, error)

AccessTo allows to access to an item into the plugin profile raw.

type Profile

type Profile struct {
	LinkID string `json:"link_id"` // unique link id, used to identify the Gakisitor

	// Scheduler configuration.
	Scheduler struct {
		// information about worker failure
		Worker struct {
			Retry    int `json:"retry"`    // how many time the scheduler restart a worker with a 'failed' tag before shutdown
			Interval int `json:"interval"` // in which interval a worker which restart is tagged has failed (in ms)
		} `json:"worker"`
	} `json:"scheduler"`

	// Network configuration
	Network struct {
		HostAddress string `json:"host_address"` // host address (IPv4 / IPv6)
		Port        int    `json:"port"`         // host port
		EnableSsl   bool   `json:"enable_ssl"`   // enable SSL (if required)
	} `json:"network"`

	// Plugins configuration
	Plugins []Plugin `json:"plugins"`

	// Log configuration
	Log struct {
		Format string `json:"format"`
		Path   string `json:"path"`
	}
	// contains filtered or unexported fields
}

Profile represents the configuration of the Gakisitor. It contains all required information about network, scheduler and plugins.

func (*Profile) Load

func (profile *Profile) Load(file ...string) error

Load loads the profile from a file. The optional parameter change the internal profile file path, if it already set.

func (*Profile) SubscribeAlteration

func (profile *Profile) SubscribeAlteration(handler func(profile *Profile, err error)) (*fsnotify.Watcher, error)

SubscribeAlteration subscribes an handler, called when the profile file was altered.

type Raw

type Raw interface{}

Raw type represents any type used to configure a plugin.

Jump to

Keyboard shortcuts

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