adk

package
v0.0.0-...-96d737d Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogLevel = "info" //trace, debug, info
View Source
var NopCapi = func(...Any) (Any, error) { return VmNil, nil }
View Source
var NopDapi = func(...Any) {}
View Source
var NopOutput = func(...Any) {}
View Source
var NopSapi = func(...Any) Any { return nil }
View Source
var VmAssertFunction = goja.AssertFunction
View Source
var VmCompile = goja.Compile
View Source
var VmNew = goja.New
View Source
var VmNil = _vm_.ToValue(nil)
View Source
var VmNopCallable = func(this VmValue, args ...VmValue) (VmValue, error) { return VmNil, nil }
View Source
var VmNopFunction = func(VmCall) VmValue { return VmNil }
View Source
var VmThrow = func(value VmValue) { panic(value) }
View Source
var VmToValue = _vm_.ToValue
View Source
var VmUndefined = goja.Undefined()

Functions

func ApiPanicF

func ApiPanicF(format string, args ...Any)

func Capture

func Capture(output Output, done Channel)

func Cascade

func Cascade(output Output, done Channel, action Action, cb func(done Channel))

func CloseAction

func CloseAction(ch chan Action)

func CloseData

func CloseData(ch chan []byte)

func CloseDone

func CloseDone(done Channel)

func CloseError

func CloseError(ch chan error)

func CloseIfRecover

func CloseIfRecover(output Output, done Channel)

func CopyContext

func CopyContext(ctx *Context, psp Any)

func Dial

func Dial(network string, address string, toms int64) (net.Conn, error)

func ForwardClose

func ForwardClose(output Output, dst Channel, src Channel)

func Future

func Future(ms int64) time.Time

func IfDone

func IfDone(done Channel, toms int64) bool

func IsClosed

func IsClosed(ch <-chan bool) bool

func IsLogPrintable

func IsLogPrintable(level string) bool

info|warn|error|panic are always displayed info is for explicit script logging or once per script events debug is for once per managed object events trace is for many per managed objects events and stack traces

func LogLevelFromEnv

func LogLevelFromEnv()

func LogRecover

func LogRecover(output Output, r Any)

func Millis

func Millis(ms int64) time.Duration

func OnDone

func OnDone(output Output, done Channel, action Action)

func OptionBool

func OptionBool(opts Map, name string, required bool, def bool) bool

func OptionInt64

func OptionInt64(opts Map, name string, required bool, def int64) int64

func OptionString

func OptionString(opts Map, name string, required bool, def string) string

func PanicF

func PanicF(format string, args ...Any)

func PanicIfErr

func PanicIfErr(err error)

func PanicTunnel

func PanicTunnel(action Action)

let original panic bubble

func Read

func Read(conn net.Conn, data []byte) (int, error)

func Readable

func Readable(s string) string

func Receive

func Receive(done Channel)

func Recover

func Recover(output Output)

func RecoverIgnore

func RecoverIgnore()

func Safe

func Safe(output Output, action Action)

func Send

func Send(done Channel, any Any)

func TraceAction

func TraceAction(action Action, tag string)

func TraceCall

func TraceCall(out Output, call VmCall)

func TraceChannel

func TraceChannel(channel Channel, tag string)

func TraceLog

func TraceLog(output Output, tag string)

func TraceTag

func TraceTag(tag string)

func Write

func Write(conn net.Conn, data []byte, toms int64) error

Types

type Action

type Action = func()

func CloserToAction

func CloserToAction(closer io.Closer) Action

type Any

type Any = interface{}

func ToExportArgs

func ToExportArgs(args ...VmValue) []Any

func WaitAny

func WaitAny(dones ...Channel) (index int, value Any, ok bool)

type Babel

type Babel interface {
	Clone() Babel
	Transform(file string, src string) (string, error)
	GetOptions() Map
	SetOptions(Map)
}

func NewBabel

func NewBabel() Babel

type Capi

type Capi = func(...Any) (Any, error)

func OptionCapi

func OptionCapi(opts Map, name string, required bool) Capi

type Chain

type Chain interface {
	C() Channel
	PC() Channel
	PPC() Channel
	Link() Chain
}

func NewChain

func NewChain(pc Channel) Chain

type Channel

type Channel = chan Any

func Run

func Run(output Output, action Action) Channel

type Context

type Context struct {
	Name          string                      //mandatory: plugin name to report when diposed
	Exit          Channel                     //mandatory: global exit signal
	Output        Output                      //mandatory: logger with levels trace|debug|info|warn|error
	Callback      func(Channel, Capi, ...Any) //mandatory: plugin callback into the vm with cancel channel (discards return value)
	AddManaged    func(string, Channel)       //mandatory: register managed object
	RemoveManaged func(string)                //mandatory: unregister managed opbject
}

type Dapi

type Dapi = func(...Any)

type Factory

type Factory = func(*Context) Plugin

type Id

type Id interface {
	Next() string
}

func NewId

func NewId(prefix string) Id

type Map

type Map = map[string]Any

type Output

type Output = func(string, ...Any)

func DefaultOutput

func DefaultOutput() Output

type PanicTrace

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

func (*PanicTrace) String

func (pt *PanicTrace) String() string

type Papi

type Papi = map[string]Sapi

type Plugin

type Plugin interface {
	Api() Papi
}

type Queue

type Queue = chan Action

type Runtime

type Runtime interface {
	AddPlugin(name string, factory Factory) Channel //register plugin
	RunString(path string, src string) Channel      //run es6 js string, path is for inline source map
	CloseDone()                                     //send done signal to all plugins
	WaitZeroTo(int64) bool                          //wait zero managed count with ms timeout
	WaitNonZeroTo(int64) bool                       //wait non zero managed count with ms timeout
	WaitAbort() bool                                //wait zero managed count with ctrl+c timeout
	Dispose() Channel                               //hard dispose internal state to avoid further execution
}

type Sapi

type Sapi = func(...Any) Any

type VmApi

type VmApi = map[string]VmFunction

type VmCall

type VmCall = goja.FunctionCall

func MakeVmCall

func MakeVmCall(args ...Any) *VmCall

type VmCallable

type VmCallable = goja.Callable

type VmError

type VmError = goja.Exception

type VmFunction

type VmFunction = func(VmCall) VmValue

func SapiToVm

func SapiToVm(sapi Sapi) VmFunction

type VmProgram

type VmProgram = goja.Program

type VmRuntime

type VmRuntime = goja.Runtime

type VmValue

type VmValue = goja.Value

func ToValueArgs

func ToValueArgs(args ...Any) []VmValue

Jump to

Keyboard shortcuts

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