interpreter

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Registered  = iota ///< the plugin is constructed but doesn't do anything
	Initialized        ///< the plugin has initialized any state required but is idle
	Started            ///< the plugin is actively running
	Stopped            ///< the plugin is no longer running
)

Variables

View Source
var (
	TimeoutInterrupter = "timeout interrupter"
)

Functions

This section is empty.

Types

type Executor

type Executor interface {
	//about retValue:0 everything is ok, != 0 , something is not correct,this transaction should be discard
	Exec(code []byte, param []byte, ttl time.Duration) (duration time.Duration)
}

type Formatter

type Formatter interface {
}

type Generator

type Generator interface {
	Generate(ctx *actioncontext.Context) Interpreter
}

type Interpreter

type Interpreter interface {
	Validator
	Executor
	Formatter
}

type Interpreters

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

func Singleton

func Singleton() *Interpreters

get the interpreter singleton

func (*Interpreters) Exec

func (self *Interpreters) Exec(ctx *actioncontext.Context) error

func (*Interpreters) ExecAsync

func (self *Interpreters) ExecAsync(ctx *actioncontext.Context) error

func (Interpreters) Find

func (self Interpreters) Find(plugin func() PluginImpl) Plugin

func (Interpreters) FindById

func (self Interpreters) FindById(id types.Hash) Plugin

func (*Interpreters) Initialize

func (self *Interpreters) Initialize()

func (*Interpreters) Register

func (self *Interpreters) Register(plugin func() PluginImpl) Plugin

register plugin, need input the constructor of plugin

func (*Interpreters) Shutdown

func (self *Interpreters) Shutdown()

func (*Interpreters) Startup

func (self *Interpreters) Startup()

type Plugin

type Plugin interface {
	GetState() State
	Name() string
	Id() types.Hash

	PluginImpl
}

type PluginImpl

type PluginImpl interface {
	Initialize()
	Startup()
	Shutdown()
	Generator
}

a interpreter must implement PluginImpl interface

type PluginName

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

func (PluginName) Id

func (pn PluginName) Id() types.Hash

func (PluginName) Name

func (pn PluginName) Name() string

func (*PluginName) Set

func (pn *PluginName) Set(pImpl interface{})

type PluginObj

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

func (PluginObj) Generate

func (obj PluginObj) Generate(ctx *actioncontext.Context) Interpreter

func (PluginObj) GetState

func (obj PluginObj) GetState() State

func (PluginObj) Id

func (obj PluginObj) Id() types.Hash

func (*PluginObj) Initialize

func (obj *PluginObj) Initialize()

func (PluginObj) Name

func (obj PluginObj) Name() string

func (*PluginObj) Shutdown

func (obj *PluginObj) Shutdown()

func (*PluginObj) Startup

func (obj *PluginObj) Startup()

type State

type State int

type Validator

type Validator interface {
}

Directories

Path Synopsis
jsre/deps
Package deps contains the console JavaScript dependencies Go embedded.
Package deps contains the console JavaScript dependencies Go embedded.
deps
Package deps contains the console JavaScript dependencies Go embedded.
Package deps contains the console JavaScript dependencies Go embedded.
cmd

Jump to

Keyboard shortcuts

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