Documentation
¶
Index ¶
- Constants
- type EnvVar
- type EnvVarLoadOpt
- type GoPool
- type LuaFuncs
- type Promise
- type PromiseEvent
- type Protocal
- type SignalStream
- type Table
- type TableAt
- type TableGetter
- type TableSetter
- type YGFunction
- type Ycho
- type YockDB
- type YockFuncInfo
- type YockFuns
- type YockJob
- type YockLib
- type YockLoader
- type YockMode
- type YockRuntime
- type YockScheduler
- type YockState
- type YockStateCheck
- type YockStateIs
- type YockStatePush
- type YockdClient
- type YockdClientFS
- type YockdClientGateway
- type YockdClientMeta
- type YockdClientNet
- type YockdClientProcess
- type YockdClientSignal
- type YocksFuncs
- type YocksFunction
Constants ¶
View Source
const ( Y_STRICT = 1 Y_DEBUG = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EnvVar ¶
type EnvVar interface {
// SetPath set operate target:
// windows: sys or user, it's required in windows.
// posix: /etc/enviroment, this only is empty method.
SetPath(string) error
// set global enviroment variable
Set(string, any) error
// set global enviroment variable when key isn't exist
SafeSet(string, any) error
// unset (delete) global enviroment variable
Unset(string) error
// set local enviroment variable
SetL(string, string) error
// set local enviroment variable when key isn't exist
SafeSetL(string, string) error
// export current enviroment string into specify file
Export(string) error
// load enviroment string to be export from disk
Load(EnvVarLoadOpt) error
// Print current enviroment variable
Print()
}
EnvVar is an interface to abstract different os enviroment variable
type EnvVarLoadOpt ¶
type LuaFuncs ¶
type LuaFuncs map[string]lua.LGFunction
type PromiseEvent ¶
type Protocal ¶
type Protocal interface {
Type() pb.ProtocalType
String() string
}
type SignalStream ¶
type SignalStream interface {
// Load returns the value of the specified singal.
// If the singal isn't exist, the second parameter returns false, and vice versa.
Load(sig string) (any, bool)
// Store settings specify the value of the singal, similar to map's kv storage.
Store(sig string, v bool)
}
SignalStream is an abstract interface for distributing and updating singals
type TableAt ¶
type TableAt interface {
ToString(n int) string
ToTable(n int) Table
ToFunctionByString(k string) *lua.LFunction
ToFloat32ByString(k string) float32
ToFloat64ByString(k string) float64
ToIntByString(k string) int
ToFunction(n int) *lua.LFunction
ToFloat32(n int) float32
ToFloat64(n int) float64
ToInt(n int) int
}
type TableGetter ¶
type TableSetter ¶
type YGFunction ¶
type Ycho ¶
type Ycho interface {
Progress(total int64, r io.Reader) io.Writer
Eventloop()
Info(msg string)
Infof(msg string, v ...any)
Debug(msg string)
Debugf(msg string, v ...any)
Warn(msg string)
Warnf(msg string, v ...any)
Fatal(msg string)
Fatalf(msg string, v ...any)
Error(msg string)
Errorf(msg string, v ...any)
Print(msg string)
}
type YockFuncInfo ¶
type YockFuns ¶
type YockFuns map[string]YGFunction
type YockLib ¶
type YockLib interface {
Name() string
Value() lua.LValue
SetField(v map[string]any)
SetFunction(name string, fn lua.LGFunction)
SetFunctions(v map[string]lua.LGFunction)
SetYFunction(v map[string]YGFunction)
SetClosure(v map[string]lua.LGFunction)
Meta() Table
SetTable(t Table)
State() YockState
SetState(s YockState)
}
type YockLoader ¶
type YockLoader interface {
// CreateLib returns a new library
// and overrides old library when it's exist
CreateLib(name string) YockLib
// OpenLib opens library to be specified
// and creates a new library when it isn't exist
OpenLib(name string) YockLib
RegLuaFn(LuaFuncs)
RegYockFn(YockFuns)
State() YockState
}
type YockMode ¶
type YockMode interface {
Mode() int32
SetMode(m int32)
UnsetMode(m int32)
Debug() bool
Strict() bool
}
var Y_MODE YockMode = yockMode(0)
type YockRuntime ¶
type YockRuntime interface {
// Call to call specify function without arguments
Call(string) ([]lua.LValue, error)
// FastCall to call specify function without arguments and not return value
FastCall(string) error
// Call to call specify function with arguments
// CallByParam(string, []lua.LValue) ([]lua.LValue, error)
// FastCallByParam to call specify function with arguments and not return value
// FastCallByParam(string, []lua.LValue) error
// Eval to execute string of script
Eval(string) error
// EvalFile to execute file of script
EvalFile(string) error
// EvalFunc to execute function
EvalFunc(lua.LValue, []lua.LValue) ([]lua.LValue, error)
// FastEvalFunc to execute function and not return value
FastEvalFunc(lua.LValue, []lua.LValue) error
// SetGlobalFn to set global function
SetGlobalFn(map[string]lua.LGFunction)
// SafeSetGlobalFn to set global function when it isn't exist
SafeSetGlobalFn(map[string]lua.LGFunction)
// GetGlobalVar returns global variable
GetGlobalVar(string) lua.LValue
// SetGlobalVar to set global variable
SetGlobalVar(string, lua.LValue)
// SafeSetGlobalVar to set global variable when variable isn't exist
SafeSetGlobalVar(string, lua.LValue)
// RegisterModule to register modules
// RegisterModule(map[string]lua.LGFunction)
// UnregisterModule to unregister specify module
// UnregisterModule(string)
// LoadModule to immediately load module to be specified
// LoadModule(string, lua.LGFunction)
// State returns LState
State() YockState
// SetState sets interp
SetState(l YockState)
// NewState returns new interp
NewState() (YockState, context.CancelFunc)
}
YockRuntime is an interface to abstract single and multiple interpreters
type YockScheduler ¶
type YockScheduler interface {
// yock runtime
YockLoader
YockRuntime
RegYocksFn(funcs YocksFuncs)
MntYocksFn(lib YockLib, funcs YocksFuncs)
// yocks field
EnvVar() EnvVar
Signal() SignalStream
Opt() Table
SetOpt(o Table)
Env() YockLib
// yocks goroutines
Do(f func())
GetTask(name string) bool
AppendTask(name string, job YockJob)
YockDB
}
type YockState ¶
type YockState interface {
Call(info YockFuncInfo, args ...any) error
YockStateIs
YockStateCheck
YockStatePush
NewLFunction(f lua.LGFunction) *lua.LFunction
NewYFunction(f YGFunction) *lua.LFunction
Exit() int
Stack(i int) (*lua.Debug, bool)
Stacktrace() string
LState() *lua.LState
Argc() int
PopAll()
Clone() YockState
}
type YockStateCheck ¶
type YockStateIs ¶
type YockStatePush ¶
type YockStatePush interface {
Throw(err error) YockState
PushError(err error) YockState
PushNil() YockState
Push(v lua.LValue) YockState
PushNilTable() YockState
PushString(str string) YockState
PushBool(b bool) YockState
PushInt(i int) YockState
Pusha(val any) YockState
PushAll(vals ...any) YockState
}
type YockdClient ¶
type YockdClient interface {
YockdClientSignal
YockdClientFS
YockdClientGateway
YockdClientMeta
YockdClientNet
YockdClientProcess
}
type YockdClientFS ¶
type YockdClientGateway ¶
type YockdClientGateway interface{}
type YockdClientMeta ¶
type YockdClientNet ¶
type YockdClientProcess ¶
type YockdClientSignal ¶
type YocksFuncs ¶
type YocksFuncs map[string]YocksFunction
type YocksFunction ¶
type YocksFunction func(yocks YockScheduler, state YockState) int
Click to show internal directories.
Click to hide internal directories.