rumble

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2020 License: CC0-1.0 Imports: 1 Imported by: 0

Documentation

Overview

Package rumble contains all definitions which external code should use to integrate with Brawler.

Index

Constants

View Source
const (
	VarProcessor = "processor" // Current event processor (new sinks will be added to this)
	VarMonitor   = "monitor"   // Current event monitor (new events will be using this)
	VarEvent     = "event"     // Current event which triggered a sink
)

Default variables for sinks

Variables

View Source
var (
	ErrInvalidConstruct = errors.New("Invalid construct")
	ErrInvalidState     = errors.New("Invalid state")
	ErrVarAccess        = errors.New("Cannot access variable")
	ErrNotANumber       = errors.New("Operand is not a number")
	ErrNotABoolean      = errors.New("Operand is not a boolean")
	ErrNotAList         = errors.New("Operand is not a list")
	ErrNotAMap          = errors.New("Operand is not a map")
	ErrNotAListOrMap    = errors.New("Operand is not a list nor a map")
)

Runtime related error types - these errors are generic errors of Rumble where the code will not check for object equality

Functions

This section is empty.

Types

type Function

type Function interface {

	/*
		Name returns the name of the function. A function should be camelCase
		and should only contain alphanumerical characters.
	*/
	Name() string

	/*
		Validate is called to validate the number of arguments, check the
		environment and to execute any initialisation code which might be
		necessary for the function.
	*/
	Validate(argsNum int, runtime Runtime) RuntimeError

	/*
		Execute executes the rumble function. This function might be called
		by several threads concurrently.
	*/
	Execute(argsVal []interface{}, vars Variables, runtime Runtime) (interface{}, RuntimeError)
}

Function is a function in Rumble.

type Runtime

type Runtime interface {

	/*
	   NewRuntimeError creates a new runtime error.
	*/
	NewRuntimeError(t error, d string) RuntimeError
}

Runtime accesses the runtime environment of the function.

type RuntimeError

type RuntimeError error

RuntimeError is a special error which contains additional internal information which are not exposed (e.g. code line).

type Variables

type Variables interface {

	/*
	   SetValue sets a new value for a variable.
	*/
	SetValue(varName string, varValue interface{}) error

	/*
	   GetValue gets the current value of a variable.
	*/
	GetValue(varName string) (interface{}, bool, error)
}

Variables accesses the variable scope of the function.

Jump to

Keyboard shortcuts

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