yocks

package
v0.0.0-...-9853328 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

dns, plugin, and driver are all derivatives of the dependency analysis pattern. They are now abandoned, see pack/dependency.go for details.

dns, plugin, and driver are all derivatives of the dependency analysis pattern. They are now abandoned, see pack/dependency.go for details.

dns, plugin, and driver are all derivatives of the dependency analysis pattern. They are now abandoned, see pack/dependency.go for details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewYockLoader

func NewYockLoader(s yocki.YockState) *yockLoader

Types

type ChannelPool

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

func (*ChannelPool) Go

func (pool *ChannelPool) Go(f func())

func (*ChannelPool) Run

func (pool *ChannelPool) Run()

type Context

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

func (*Context) Call

func (ctx *Context) Call(fn *lua.LFunction) (c contextExitCode)

func (*Context) Close

func (ctx *Context) Close()

func (*Context) Extends

func (ctx *Context) Extends(super *Context)

type CooperationSingalStream

type CooperationSingalStream struct {
	*SingleSignalStream
	// contains filtered or unexported fields
}

CooperationSingalStream is a distributed implementation of SignalStream, using grpc + protobuf to transmit signals.

func NewCooperationSingalStream

func NewCooperationSingalStream(c *net.DirectClient) *CooperationSingalStream

func (*CooperationSingalStream) Load

func (stream *CooperationSingalStream) Load(sig string) (any, bool)

Load returns the value of the specified singal. If the singal isn't exist, the second parameter returns false, and vice versa. In CooperationSingalStream, each load will send a request to daemon to ask for the signal status, and set the value if it exists.

func (*CooperationSingalStream) Store

func (stream *CooperationSingalStream) Store(sig string, v bool)

Store settings specify the value of the singal, similar to map's kv storage and send it to daemon.

type DNS

type DNS struct {
	Driver  map[string]asset `json:"driver"`
	Plugin  map[string]asset `json:"plugin"`
	Version string           `json:"version"`
	// contains filtered or unexported fields
}

func CreateDNS

func CreateDNS(path string) *DNS

func OpenDNS

func OpenDNS(path string) *DNS

func (*DNS) AliasDriver

func (dns *DNS) AliasDriver(domain, alias string) error

func (*DNS) AliasPlugin

func (dns *DNS) AliasPlugin(domain, alias string) error

func (*DNS) GetDriver

func (dns *DNS) GetDriver(domain string) asset

func (*DNS) GetPlugin

func (dns *DNS) GetPlugin(domain string) asset

func (*DNS) PutDriver

func (dns *DNS) PutDriver(domain, url, path string) error

func (*DNS) PutPlugin

func (dns *DNS) PutPlugin(domain, url, path string) error

func (*DNS) UnputDriver

func (dns *DNS) UnputDriver(domain string)

func (*DNS) UnputPlugin

func (dns *DNS) UnputPlugin(domain string)

func (*DNS) UpdateDriver

func (dns *DNS) UpdateDriver(domain, url, path string)

func (*DNS) UpdatePlugin

func (dns *DNS) UpdatePlugin(domain, url, path string)

type PriorityPool

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

func (*PriorityPool) Go

func (pool *PriorityPool) Go(f func())

type RandomPool

type RandomPool struct{}

type SingleSignalStream

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

SingleSignalStream is a single-process implementation of SignalStream, where signals only flow in the process.

func NewSingleSignalStream

func NewSingleSignalStream() *SingleSignalStream

func (*SingleSignalStream) Load

func (stream *SingleSignalStream) Load(sig string) (any, bool)

Load returns the value of the specified singal. If the singal isn't exist, the second parameter returns false, and vice versa.

func (*SingleSignalStream) Store

func (stream *SingleSignalStream) Store(sig string, v bool)

Store settings specify the value of the singal, similar to map's kv storage.

type YGFunction

type YGFunction func(*YockScheduler, *yockr.YockState) int

type YockModeManager

type YockModeManager int32

func (*YockModeManager) Debug

func (ym *YockModeManager) Debug() bool

func (*YockModeManager) Mode

func (ym *YockModeManager) Mode() int32

func (*YockModeManager) SetMode

func (ym *YockModeManager) SetMode(m int32)

func (*YockModeManager) Strict

func (ym *YockModeManager) Strict() bool

func (*YockModeManager) UnsetMode

func (ym *YockModeManager) UnsetMode(m int32)

type YockScheduler

type YockScheduler struct {
	// Interpreter for yock scripts.
	//
	// Note that concurrency is not safe,
	// so each different task or asynchronous function will call the thread method
	// to derive a new interpreter and isolate execution.
	yocki.YockRuntime
	// contains filtered or unexported fields
}

YockScheduler runs and schedules yock scripts in task units.

func Default

func Default(opts ...YockSchedulerOption) *YockScheduler

func New

func New(opts ...YockSchedulerOption) *YockScheduler

func (*YockScheduler) AppendTask

func (yocks *YockScheduler) AppendTask(name string, job yocki.YockJob)

func (YockScheduler) CreateLib

func (loader YockScheduler) CreateLib(name string) yocki.YockLib

func (*YockScheduler) Do

func (yocks *YockScheduler) Do(f func())

func (*YockScheduler) Env

func (yocks *YockScheduler) Env() yocki.YockLib

func (*YockScheduler) EnvVar

func (yocks *YockScheduler) EnvVar() yocki.EnvVar

func (*YockScheduler) EventLoop

func (yocks *YockScheduler) EventLoop()

EventLoop periodically takes fn from goroutines and assigns goroutine execution

In a future version, event loop will be based on the AST syntax tree or not

func (YockScheduler) Get

func (db YockScheduler) Get(k string) lua.LValue

func (*YockScheduler) GetTask

func (yocks *YockScheduler) GetTask(name string) bool

func (*YockScheduler) LaunchTask

func (yocks *YockScheduler) LaunchTask(name string)

LaunchTask executes the corresponding task based on the task name

func (*YockScheduler) LoadLibs

func (yocks *YockScheduler) LoadLibs()

LoadLibs loads the libraries that go provides to Lua

func (*YockScheduler) LoadLibsV1

func (yocks *YockScheduler) LoadLibsV1()

deprecated

func (*YockScheduler) LoadYockd

func (yocks *YockScheduler) LoadYockd()

func (*YockScheduler) LoadYocki

func (yocks *YockScheduler) LoadYocki()

func (*YockScheduler) MntYocksFn

func (yocks *YockScheduler) MntYocksFn(lib yocki.YockLib, funcs yocki.YocksFuncs)

func (YockScheduler) OpenLib

func (loader YockScheduler) OpenLib(name string) yocki.YockLib

func (*YockScheduler) Opt

func (yocks *YockScheduler) Opt() yocki.Table

func (YockScheduler) Put

func (db YockScheduler) Put(k string, v lua.LValue)

func (YockScheduler) RegLuaFn

func (loader YockScheduler) RegLuaFn(v yocki.LuaFuncs)

func (YockScheduler) RegYockFn

func (loader YockScheduler) RegYockFn(v yocki.YockFuns)

func (*YockScheduler) RegYocksFn

func (yocks *YockScheduler) RegYocksFn(funcs yocki.YocksFuncs)

func (*YockScheduler) SetOpt

func (yocks *YockScheduler) SetOpt(o yocki.Table)

func (*YockScheduler) Signal

func (yocks *YockScheduler) Signal() yocki.SignalStream

func (*YockScheduler) State

func (yocks *YockScheduler) State() yocki.YockState

type YockSchedulerOption

type YockSchedulerOption func(*YockScheduler) error

func OptionEnableEnvVar

func OptionEnableEnvVar() YockSchedulerOption

OptionEnableEnvVar can CRUD environment variable. In some systems, you need administrator privileges to start

func OptionLibPath

func OptionLibPath(path string) YockSchedulerOption

func OptionUpgradeSingalStream

func OptionUpgradeSingalStream() YockSchedulerOption

OptionUpgradeSingalStream upgrades SingleSignalStream to CooperationSingalStream to meet distributed needs.

Jump to

Keyboard shortcuts

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