core

package
v0.0.0-...-f342e06 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultStrategy is the strategy to use if none has been specified.
	DefaultStrategy = "rr"
)
View Source
const TemplateName = "template"

TemplateName is the name of our template as required by the template library.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExchangeFunc

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

ExchangeFunc is special function which returns all the values of a given key in the exposed world, and sets it's own.

func (*ExchangeFunc) Close

func (obj *ExchangeFunc) Close() error

Close runs some shutdown code for this function and turns off the stream.

func (*ExchangeFunc) Info

func (obj *ExchangeFunc) Info() *interfaces.Info

Info returns some static info about itself.

func (*ExchangeFunc) Init

func (obj *ExchangeFunc) Init(init *interfaces.Init) error

Init runs some startup code for this function.

func (*ExchangeFunc) Stream

func (obj *ExchangeFunc) Stream() error

Stream returns the changing values that this func has over time.

func (*ExchangeFunc) Validate

func (obj *ExchangeFunc) Validate() error

Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.

type KVLookupFunc

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

KVLookupFunc is special function which returns all the values of a given key in the exposed world. It is similar to exchange, but it does not set a key.

func (*KVLookupFunc) Close

func (obj *KVLookupFunc) Close() error

Close runs some shutdown code for this function and turns off the stream.

func (*KVLookupFunc) Info

func (obj *KVLookupFunc) Info() *interfaces.Info

Info returns some static info about itself.

func (*KVLookupFunc) Init

func (obj *KVLookupFunc) Init(init *interfaces.Init) error

Init runs some startup code for this function.

func (*KVLookupFunc) Stream

func (obj *KVLookupFunc) Stream() error

Stream returns the changing values that this func has over time.

func (*KVLookupFunc) Validate

func (obj *KVLookupFunc) Validate() error

Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.

type PrintfFunc

type PrintfFunc struct {
	Type *types.Type // final full type of our function
	// contains filtered or unexported fields
}

PrintfFunc is a static polymorphic function that compiles a format string and returns the output as a string. It bases its output on the values passed in to it. It examines the type of the arguments at compile time and then determines the static function signature by parsing the format string and using that to determine the final function signature. One consequence of this is that the format string must be a static string which is known at compile time. This is reasonable, because if it was a reactive, changing string, then we could expect the type signature to change, which is not allowed in our statically typed language.

func (*PrintfFunc) Build

func (obj *PrintfFunc) Build(typ *types.Type) error

Build takes the now known function signature and stores it so that this function can appear to be static. That type is used to build our function statically.

func (*PrintfFunc) Close

func (obj *PrintfFunc) Close() error

Close runs some shutdown code for this function and turns off the stream.

func (*PrintfFunc) Info

func (obj *PrintfFunc) Info() *interfaces.Info

Info returns some static info about itself.

func (*PrintfFunc) Init

func (obj *PrintfFunc) Init(init *interfaces.Init) error

Init runs some startup code for this function.

func (*PrintfFunc) Polymorphisms

func (obj *PrintfFunc) Polymorphisms(partialType *types.Type, partialValues []types.Value) ([]*types.Type, error)

Polymorphisms returns the possible type signature for this function. In this case, since the number of arguments can be infinite, it returns the final precise type if it can be gleamed from the format argument. If it cannot, it is because either the format argument was not known statically, or because it had an invalid format string.

func (*PrintfFunc) Stream

func (obj *PrintfFunc) Stream() error

Stream returns the changing values that this func has over time.

func (*PrintfFunc) Validate

func (obj *PrintfFunc) Validate() error

Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.

type Random1Func

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

Random1Func returns one random string of a certain length. XXX: return a stream instead, and combine this with a first(?) function which takes the first value and then puts backpressure on the stream. This should notify parent functions somehow that their values are no longer required so that they can shutdown if possible. Maybe it should be returning a stream of floats [0,1] as well, which someone can later map to the alphabet that they want. Should random() take an interval to know how often to spit out values? It could also just do it once per second, and we could filter for less. If we want something high precision, we could add that in the future... We could name that "random" and this one can be "random1" until we deprecate it.

func (*Random1Func) Close

func (obj *Random1Func) Close() error

Close runs some shutdown code for this function and turns off the stream.

func (*Random1Func) Info

func (obj *Random1Func) Info() *interfaces.Info

Info returns some static info about itself.

func (*Random1Func) Init

func (obj *Random1Func) Init(init *interfaces.Init) error

Init runs some startup code for this function.

func (*Random1Func) Stream

func (obj *Random1Func) Stream() error

Stream returns the single value that was generated and then closes.

func (*Random1Func) Validate

func (obj *Random1Func) Validate() error

Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.

type SchedulePolyFunc

type SchedulePolyFunc struct {
	Type *types.Type // this is the type of value stored in our list
	// contains filtered or unexported fields
}

SchedulePolyFunc is special function which determines where code should run in the cluster.

func (*SchedulePolyFunc) Build

func (obj *SchedulePolyFunc) Build(typ *types.Type) error

Build is run to turn the polymorphic, undetermined function, into the specific statically typed version. It is usually run after Unify completes, and must be run before Info() and any of the other Func interface methods are used. This function is idempotent, as long as the arg isn't changed between runs.

func (*SchedulePolyFunc) Close

func (obj *SchedulePolyFunc) Close() error

Close runs some shutdown code for this function and turns off the stream.

func (*SchedulePolyFunc) Info

func (obj *SchedulePolyFunc) Info() *interfaces.Info

Info returns some static info about itself. Build must be called before this will return correct data.

func (*SchedulePolyFunc) Init

func (obj *SchedulePolyFunc) Init(init *interfaces.Init) error

Init runs some startup code for this function.

func (*SchedulePolyFunc) Polymorphisms

func (obj *SchedulePolyFunc) Polymorphisms(partialType *types.Type, partialValues []types.Value) ([]*types.Type, error)

Polymorphisms returns the list of possible function signatures available for this static polymorphic function. It relies on type and value hints to limit the number of returned possibilities.

func (*SchedulePolyFunc) Stream

func (obj *SchedulePolyFunc) Stream() error

Stream returns the changing values that this func has over time.

func (*SchedulePolyFunc) Validate

func (obj *SchedulePolyFunc) Validate() error

Validate tells us if the input struct takes a valid form.

type TemplateFunc

type TemplateFunc struct {
	Type *types.Type // type of vars
	// contains filtered or unexported fields
}

TemplateFunc is a static polymorphic function that compiles a template and returns the output as a string. It bases its output on the values passed in to it. It examines the type of the second argument (the input data vars) at compile time and then determines the static functions signature by including that in the overall signature. TODO: We *might* need to add events for internal function changes over time, but only if they are not pure. We currently only use simple, pure functions.

func (*TemplateFunc) Build

func (obj *TemplateFunc) Build(typ *types.Type) error

Build takes the now known function signature and stores it so that this function can appear to be static. It extracts the type of the vars argument, which is the dynamic part which can change. That type is used to build our function statically.

func (*TemplateFunc) Close

func (obj *TemplateFunc) Close() error

Close runs some shutdown code for this function and turns off the stream.

func (*TemplateFunc) Info

func (obj *TemplateFunc) Info() *interfaces.Info

Info returns some static info about itself.

func (*TemplateFunc) Init

func (obj *TemplateFunc) Init(init *interfaces.Init) error

Init runs some startup code for this function.

func (*TemplateFunc) Polymorphisms

func (obj *TemplateFunc) Polymorphisms(partialType *types.Type, partialValues []types.Value) ([]*types.Type, error)

Polymorphisms returns the possible type signatures for this template. In this case, since the second argument can be an infinite number of values, it instead returns either the final precise type (if it can be gleamed from the input partials) or if it cannot, it returns a single entry with the complete type but with the variable second argument specified as a `variant` type. If it encounters any partial type specifications which are not possible, then it errors out. This could happen if you specified a non string template arg. XXX: is there a better API than returning a buried `variant` type?

func (*TemplateFunc) Stream

func (obj *TemplateFunc) Stream() error

Stream returns the changing values that this func has over time.

func (*TemplateFunc) Validate

func (obj *TemplateFunc) Validate() error

Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.

type VUMeterFunc

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

VUMeterFunc is a gimmic function to display a vu meter from the microphone.

func (*VUMeterFunc) Close

func (obj *VUMeterFunc) Close() error

Close runs some shutdown code for this function and turns off the stream.

func (*VUMeterFunc) Info

func (obj *VUMeterFunc) Info() *interfaces.Info

Info returns some static info about itself.

func (*VUMeterFunc) Init

func (obj *VUMeterFunc) Init(init *interfaces.Init) error

Init runs some startup code for this function.

func (*VUMeterFunc) Stream

func (obj *VUMeterFunc) Stream() error

Stream returns the changing values that this func has over time.

func (*VUMeterFunc) Validate

func (obj *VUMeterFunc) Validate() error

Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.

Jump to

Keyboard shortcuts

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