Documentation ¶
Index ¶
- Constants
- Variables
- func ActorOpt(opt ...interface{}) []interface{}
- func AppRestart(name string) (err error)
- func AppStart(app Application) (err error)
- func AppStop(name string)
- func Call(pid *Pid, request interface{}) (bool, interface{})
- func CallName(name string, request interface{}) (bool, interface{})
- func CallNameNode(name string, node interface{}, request interface{}) (bool, interface{})
- func CallTimeOut(pid *Pid, request interface{}, timeOut time.Duration) (bool, interface{})
- func Cast(pid *Pid, msg interface{})
- func CastName(name string, msg interface{})
- func CastNameNode(name string, node interface{}, msg interface{})
- func CatchFun(f func())
- func ConsoleArg(example string) consoleArg
- func ConsoleCommit(commit string) consoleCommit
- func ConsoleConfirm(confirm string) consoleConfirm
- func ConsoleHandler(command string, handler consoleHandler, opt ...interface{}) *chandler
- func DayNum(t time.Time) int64
- func DayNumFromUnix(now int64) int64
- func DebugLog(format string, args ...interface{})
- func DeepCopy(src interface{}) interface{}
- func ErrorLog(format string, args ...interface{})
- func GetMainRoot() string
- func InitStop()
- func IsNodeConnect(nodeName string) bool
- func KernelStart(start func(), stop func())
- func Link(srcPid, destPid *Pid)
- func LoggerWriter() io.Writer
- func MakeArgs(args ...interface{}) []interface{}
- func Midnight() int64
- func NodeDisconnect(node *Node)
- func Now() int64
- func Now2() int64
- func NowToTime(now int64) time.Time
- func NowToTimeString(now int64) string
- func Register(name string, pid *Pid)
- func RegisterNotExist(name string, pid *Pid)
- func Reply(recCh chan interface{}, callID int64, result interface{})
- func SendAfter(timerType timerType, pid *Pid, inv int64, msg interface{})
- func SendAfterForever(pid *Pid, inv int64, msg interface{})
- func SetLogLevel(lv LogLevel)
- func SetLoggerOut(writer io.Writer)
- func SetNodeNetWork(node *Node, pid *Pid)
- func SetSelfNodeName(name string)
- func StartConsole(handlers ...*chandler)
- func SupStop(sup interface{})
- func TimeString(t time.Time) string
- func TryGetName(pid *Pid) string
- func UnHandleMsg(msg interface{})
- func UnRegister(name string)
- func WeekDay() int64
- func WeekDayFromUnix(now int64) int64
- func WeekOneMidnight() int64
- type Actor
- type ActorChanCacheSize
- type AppBootType
- type AppStopType
- type Application
- type CallError
- type CallInfo
- type CallResult
- type ConsoleCommand
- type Context
- func (c *Context) Call(pid *Pid, request interface{}) (bool, interface{})
- func (c *Context) CallName(name string, request interface{}) (bool, interface{})
- func (c *Context) CallNameNode(name string, node interface{}, request interface{}) (bool, interface{})
- func (c *Context) Cast(pid *Pid, msg interface{})
- func (c *Context) CastName(name string, msg interface{})
- func (c *Context) CastNameNode(name string, node interface{}, msg interface{})
- func (c *Context) CastSelf(msg interface{})
- func (c *Context) ChangeCallMode()
- func (c *Context) Exit(reason string)
- func (c *Context) Link(pid *Pid)
- func (c *Context) Name() string
- func (c *Context) Self() *Pid
- func (c *Context) StartLink(newActor *Actor, args ...interface{}) (*Pid, interface{})
- func (c *Context) StartLinkOpt(newActor *Actor, opt []interface{}, args ...interface{}) (*Pid, interface{})
- func (c *Context) StartNameLink(name string, newActor *Actor, args ...interface{}) (*Pid, interface{})
- type Empty
- type ErrorHandleFunc
- type HandleCallFunc
- type HandleCastFunc
- type InitFunc
- type KMsg
- type LogLevel
- type Loop
- type Node
- type NodeCall
- type NodeCallName
- type NodeMsg
- type NodeMsgName
- type Pid
- func DecodePid(buf []byte, index int) (int, *Pid)
- func GetNodeNetWork(node *Node) (*Pid, bool)
- func LocalPid(id int64) *Pid
- func Start(newActor *Actor, args ...interface{}) (*Pid, interface{})
- func StartName(name string, newActor *Actor, args ...interface{}) (*Pid, interface{})
- func StartNameOpt(name string, newActor *Actor, opt []interface{}, args ...interface{}) (*Pid, interface{})
- func StartOpt(actor *Actor, opt []interface{}, args ...interface{}) (*Pid, interface{})
- func SupStart(name string, initChild ...*SupChild) *Pid
- func SupStartChild(sup interface{}, child *SupChild) (interface{}, *Pid)
- func WhereIs(name string) *Pid
- type PidExit
- type SupChild
- type SupChildInfo
- type Terminate
- type TerminateFunc
- type TimerChan
Constants ¶
View Source
const ( ExitReasonNormal = "normal" ExitReasonError = "error" )
View Source
const ( SupChildTypeWorker = iota SupChildTypeSup )
View Source
const ( TimerTypeForever timerType = 1 << iota TimerTypeOnce )
View Source
const ( CallErrorTypeTimeOut callErrorType = iota + 1 CallErrorTypeNoProc CallErrorTypeNodeNotConnect )
View Source
const ( APP_BOOT_TYPE_START = iota + 1 APP_BOOT_TYPE_RESTART )
View Source
const ( APP_STOP_TYPE_NORMAL = iota + 1 APP_STOP_TYPE_RESTART )
View Source
const (
Millisecond int64 = 1000
)
Variables ¶
View Source
var Env = &env{ WriteLogStd: true, LogPath: "", ActorChanCacheSize: 100, timerMinTick: 100, TimerProcNum: 3, }
View Source
var ErrAppAlreadyStarted = errors.New("app already started ")
View Source
var ErrAppNotStart = errors.New("app not Start ")
View Source
var ErrAppStart = errors.New("app start catch error ")
Functions ¶
func AppRestart ¶
func AppStart ¶
func AppStart(app Application) (err error)
func CallNameNode ¶
func CallTimeOut ¶
func CastNameNode ¶
func CastNameNode(name string, node interface{}, msg interface{})
func ConsoleArg ¶
func ConsoleArg(example string) consoleArg
func ConsoleCommit ¶
func ConsoleCommit(commit string) consoleCommit
func ConsoleConfirm ¶
func ConsoleConfirm(confirm string) consoleConfirm
func ConsoleHandler ¶
func ConsoleHandler(command string, handler consoleHandler, opt ...interface{}) *chandler
func IsNodeConnect ¶
func KernelStart ¶
func KernelStart(start func(), stop func())
func LoggerWriter ¶
func NodeDisconnect ¶
func NodeDisconnect(node *Node)
func NowToTimeString ¶
func RegisterNotExist ¶
func SendAfterForever ¶
func SetLogLevel ¶
func SetLogLevel(lv LogLevel)
func SetLoggerOut ¶
func SetNodeNetWork ¶
func SetSelfNodeName ¶
func SetSelfNodeName(name string)
func StartConsole ¶
func StartConsole(handlers ...*chandler)
func TimeString ¶
func TryGetName ¶
func UnHandleMsg ¶
func UnHandleMsg(msg interface{})
func UnRegister ¶
func UnRegister(name string)
func WeekDayFromUnix ¶
Types ¶
type Actor ¶
type Actor struct { // 初始化回调 Init InitFunc // 接收消息 HandleCast HandleCastFunc // 接受同步调用 HandleCall HandleCallFunc // actor退出回调 // 非必要实现函数 Terminate TerminateFunc // 当发生catch错误时调用,如果返回false,那么进程将会退出 // 非必要实现函数 ErrorHandler ErrorHandleFunc }
type ActorChanCacheSize ¶
type ActorChanCacheSize int
type AppBootType ¶
type AppBootType int
type AppStopType ¶
type AppStopType int
type Application ¶
type Application interface { Name() string Start(bootType AppBootType) *Pid // return the supervisor pid Stop(stopType AppStopType) SetEnv(Key string, value interface{}) GetEnv(key string) interface{} }
func AppInfo ¶
func AppInfo(name string) Application
type CallError ¶
type CallError struct { ErrType callErrorType // contains filtered or unexported fields }
type CallResult ¶
type CallResult struct { ID int64 Result interface{} }
type ConsoleCommand ¶
type Context ¶
type Context struct { State interface{} // contains filtered or unexported fields }
func (*Context) CallNameNode ¶
func (*Context) CastNameNode ¶
func (*Context) ChangeCallMode ¶
func (c *Context) ChangeCallMode()
func (*Context) StartLinkOpt ¶
type ErrorHandleFunc ¶
type HandleCallFunc ¶
type HandleCallFunc func(ctx *Context, request interface{}) interface{}
type HandleCastFunc ¶
type HandleCastFunc func(ctx *Context, msg interface{})
type NodeCallName ¶
type NodeMsgName ¶
type NodeMsgName struct { Dest string Msg interface{} }
type Pid ¶
type Pid struct {
// contains filtered or unexported fields
}
func GetNodeNetWork ¶
func StartNameOpt ¶
func SupStartChild ¶
func (*Pid) GetChannel ¶
func (p *Pid) GetChannel() chan interface{}
type SupChildInfo ¶
func SupWhichChild ¶
func SupWhichChild(sup interface{}) []*SupChildInfo
type TerminateFunc ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.