Documentation ¶
Index ¶
- Constants
- Variables
- func C2S_Promise_MessageID() rpc.MessageID
- func C2S_Promise_MessageName() string
- func C2S_Promise_ResponseMessageID() rpc.MessageID
- func Close()
- func DefaultDecider(reason interface{}) actor.Directive
- func ForwardToChildren(sender *actor.PID, iRecv nrpc.IMessage, iSend nrpc.IMessage, ctx actor.Context, ...)
- func Init(logLevel alog.Level, logger nlog.ILogger)
- func IsPIDPtrEmpty(pid *actor.PID) bool
- func IsPIDValueEmpty(pid actor.PID) bool
- func Logger() log.ILogger
- func Put_C2S_Promise(i interface{})
- func Put_S2C_Promise(i interface{})
- func RequestFuture(pid *actor.PID, send nrpc.IMessage, timeout time.Duration) (nrpc.IMessage, error)
- func S2C_Promise_MessageID() rpc.MessageID
- func S2C_Promise_MessageName() string
- func S2C_Promise_ResponseMessageID() rpc.MessageID
- type Actor
- func (a *Actor) Debug(format string, args ...interface{})
- func (a *Actor) DispatchEvent(iEvent nevent.IEvent, ctx actor.Context, args ...interface{}) (err error)
- func (a *Actor) EachLogic(fn func(id nexport.LogicID, logic nexport.ILogic) (continued bool))
- func (a *Actor) Error(format string, args ...interface{})
- func (a *Actor) GetLogic(id nexport.LogicID) nexport.ILogic
- func (a Actor) HttpServerListener() net.Listener
- func (a *Actor) Info(format string, args ...interface{})
- func (a Actor) IsStopping() bool
- func (a Actor) Logger() nlog.ILogger
- func (a *Actor) NewHttpTask(timeout time.Duration, tag HttpTaskTag, prepare OnHttpTaskPrepare, ...) (taskID HttpTaskID, err error)
- func (a *Actor) NewLoopTimer(dur time.Duration, tag TimerID, cb TimerCallback) TimerID
- func (a *Actor) NewPromise() (promise *Promise)
- func (a *Actor) NewRPCPromise(iRequestMessage nrpc.IMessage, receiver *actor.PID, cb PromiseCallback) (promise *Promise)
- func (a *Actor) NewTimer(dur time.Duration, tag TimerTag, cb TimerCallback) TimerID
- func (a Actor) PID() *actor.PID
- func (a Actor) ParentPID() *actor.PID
- func (a *Actor) Poison() error
- func (a *Actor) PoisonAndWait() error
- func (a *Actor) PostEvent(iEvent nevent.IEvent)
- func (a Actor) PromiseNum() int
- func (a *Actor) Receive(ctx actor.Context)
- func (a *Actor) RegisterEventHandler(id nevent.ID, h nevent.Handler)
- func (a *Actor) RegisterHttpRequestHandler(pattern string, fn http.HandlerFunc, option *HttpRequestHandlerOption) (err error)
- func (a *Actor) RegisterMessageHandler(id npb.MessageID, handler npb.MessageHandler) (err error)
- func (a *Actor) RegisterRPCHandler(id nrpc.MessageID, handler nrpc.MessageHandler) (err error)
- func (a *Actor) SetSign(sign string)
- func (a Actor) Sign() string
- func (a *Actor) Start(ctx actor.Context, name string) (err error)
- func (a *Actor) Stop() error
- func (a *Actor) StopAndWait() error
- func (a *Actor) StopTimer(id TimerID) error
- func (a *Actor) WaitForStarted()
- func (a *Actor) WaitForStopped()
- func (a *Actor) Warn(format string, args ...interface{})
- type C2S_Promise
- func (m *C2S_Promise) Clone() *C2S_Promise
- func (*C2S_Promise) Descriptor() ([]byte, []int)
- func (this *C2S_Promise) Equal(that interface{}) bool
- func (m *C2S_Promise) GetReqMsgData() []byte
- func (m *C2S_Promise) GetReqMsgID() uint32
- func (m *C2S_Promise) GetSeq() uint64
- func (this *C2S_Promise) GoString() string
- func (m *C2S_Promise) Marshal() (dAtA []byte, err error)
- func (m *C2S_Promise) MarshalTo(dAtA []byte) (int, error)
- func (m *C2S_Promise) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (C2S_Promise) MessageID() rpc.MessageID
- func (C2S_Promise) MessageName() string
- func (*C2S_Promise) ProtoMessage()
- func (C2S_Promise) RPC()
- func (m *C2S_Promise) Reset()
- func (m *C2S_Promise) ResetEx()
- func (C2S_Promise) ResponseMessageID() rpc.MessageID
- func (m *C2S_Promise) Size() (n int)
- func (this *C2S_Promise) String() string
- func (m *C2S_Promise) Unmarshal(dAtA []byte) error
- func (m *C2S_Promise) XXX_DiscardUnknown()
- func (m *C2S_Promise) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *C2S_Promise) XXX_Merge(src proto.Message)
- func (m *C2S_Promise) XXX_Size() int
- func (m *C2S_Promise) XXX_Unmarshal(b []byte) error
- type ErrPromiseMarshalResponseMessageFail
- type ErrPromiseNotExist
- type ErrPromiseProduceRequestMessageFail
- type ErrPromiseProduceResponseMessageFail
- type ErrPromiseTimeout
- type ErrPromiseUnmarshalRequestMessageFail
- type ErrPromiseUnmarshalResponseMessageFail
- type HandlerOptionFunc
- type HttpRequestHandlerOption
- type HttpTask
- type HttpTaskID
- type HttpTaskManager
- type HttpTaskTag
- type IActor
- type IPromiseTask
- type OnHttpTaskCompleted
- type OnHttpTaskPrepare
- type OptionFunc
- func WithDecider(decider actor.DeciderFunc) OptionFunc
- func WithEvent(before VFBeforeDispatchEvent, after VFAfterDispatchEvent) OptionFunc
- func WithHttpServer(listenAddr string, certFile string, keyFile string, ...) OptionFunc
- func WithHttpTask(before VFBeforeCompleteHttpTask, after VFAfterCompleteHttpTask) OptionFunc
- func WithLogger(logger nlog.ILogger) OptionFunc
- func WithLogics(logics map[nexport.LogicID]nexport.ILogic) OptionFunc
- func WithMailBoxSize(mailBoxSize int) OptionFunc
- func WithMessage(iProtocol npb.IProtocol, before VFBeforeDispatchMessage, ...) OptionFunc
- func WithOnActorTerminate(vf VFOnActorTerminated) OptionFunc
- func WithOnReceiveMessage(vf VFOnReceiveMessage) OptionFunc
- func WithOnRestarted(vf VFOnRestarted) OptionFunc
- func WithOnRestarting(vf VFOnRestarting) OptionFunc
- func WithOnStarted(vf VFOnStarted) OptionFunc
- func WithOnStopped(vf VFOnStopped) OptionFunc
- func WithOnStopping(vf VFOnStopping) OptionFunc
- func WithPulse(interval time.Duration, vf VFOnPulse) OptionFunc
- func WithRPC(iProtocol nrpc.IProtocol, before VFBeforeDispatchRPC, after VFAfterDispatchRPC) OptionFunc
- func WithStartedWaitGroup(startedWg *sync.WaitGroup) OptionFunc
- func WithStoppedWaitGroup(stoppedWg *sync.WaitGroup) OptionFunc
- func WithTimer(before VFBeforeTriggerTimer, after VFAfterTriggerTimer) OptionFunc
- type Promise
- type PromiseCallback
- type PromiseContext
- func (p *PromiseContext) Error() error
- func (p PromiseContext) Receiver() *actor.PID
- func (p PromiseContext) RequestMessage() nrpc.IMessage
- func (p PromiseContext) Requested() bool
- func (p PromiseContext) ResponseMessage() nrpc.IMessage
- func (p PromiseContext) Seq() PromiseSeq
- func (p *PromiseContext) SetError(err error)
- func (p *PromiseContext) SetReceiver(receiver *actor.PID)
- func (p *PromiseContext) SetRequestMessage(iRequestMessage nrpc.IMessage)
- func (p *PromiseContext) SetRequested(requested bool)
- func (p *PromiseContext) SetResponseMessage(iResponseMessage nrpc.IMessage)
- type PromiseOnCompleted
- type PromiseSeq
- type S2C_Promise
- func (m *S2C_Promise) Clone() *S2C_Promise
- func (*S2C_Promise) Descriptor() ([]byte, []int)
- func (this *S2C_Promise) Equal(that interface{}) bool
- func (m *S2C_Promise) GetRespMsgData() []byte
- func (m *S2C_Promise) GetRespMsgID() uint32
- func (m *S2C_Promise) GetSeq() uint64
- func (this *S2C_Promise) GoString() string
- func (m *S2C_Promise) Marshal() (dAtA []byte, err error)
- func (m *S2C_Promise) MarshalTo(dAtA []byte) (int, error)
- func (m *S2C_Promise) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (S2C_Promise) MessageID() rpc.MessageID
- func (S2C_Promise) MessageName() string
- func (*S2C_Promise) ProtoMessage()
- func (S2C_Promise) RPC()
- func (m *S2C_Promise) Reset()
- func (m *S2C_Promise) ResetEx()
- func (S2C_Promise) ResponseMessageID() rpc.MessageID
- func (m *S2C_Promise) Size() (n int)
- func (this *S2C_Promise) String() string
- func (m *S2C_Promise) Unmarshal(dAtA []byte) error
- func (m *S2C_Promise) XXX_DiscardUnknown()
- func (m *S2C_Promise) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *S2C_Promise) XXX_Merge(src proto.Message)
- func (m *S2C_Promise) XXX_Size() int
- func (m *S2C_Promise) XXX_Unmarshal(b []byte) error
- type TimerCallback
- type TimerID
- type TimerManager
- func (m *TimerManager) NewLoopTimer(dur time.Duration, callback TimerCallback) TimerID
- func (m *TimerManager) NewLoopTimerWithTag(dur time.Duration, tag TimerTag, callback TimerCallback) TimerID
- func (m *TimerManager) NewTimer(dur time.Duration, callback TimerCallback) TimerID
- func (m *TimerManager) NewTimerWithTag(dur time.Duration, tag TimerTag, callback TimerCallback) TimerID
- func (m *TimerManager) Stop(id TimerID) error
- func (m *TimerManager) StopAll()
- func (m *TimerManager) Trigger(id TimerID) error
- type TimerTag
- type VFAfterCompleteHttpTask
- type VFAfterDispatchEvent
- type VFAfterDispatchHttpRequest
- type VFAfterDispatchMessage
- type VFAfterDispatchRPC
- type VFAfterRunHttpServer
- type VFAfterTriggerTimer
- type VFBeforeCompleteHttpTask
- type VFBeforeDispatchEvent
- type VFBeforeDispatchHttpRequest
- type VFBeforeDispatchMessage
- type VFBeforeDispatchRPC
- type VFBeforeTriggerTimer
- type VFOnActorTerminated
- type VFOnPulse
- type VFOnReceiveMessage
- type VFOnRestarted
- type VFOnRestarting
- type VFOnStarted
- type VFOnStopped
- type VFOnStopping
Constants ¶
const DefaultHttpRequestMinDispatchInterval = 0 * time.Millisecond
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const DefaultHttpRequestTimeout = 60 * time.Second
Variables ¶
var ( ErrInvalidLengthProto = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowProto = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupProto = fmt.Errorf("proto: unexpected end of group") )
var ErrAlreadyStop = errors.New("already stop")
var ErrHttpTaskNotFound = errors.New("http task not found")
var ErrHttpTaskOnCompletedMustNotNil = errors.New("http task on completed must not nil")
var ErrHttpTaskRequestMustNotNil = errors.New("http task request must not nil")
var ErrHttpTaskTimeoutMustGreaterThanZero = errors.New("http task timeout must > 0")
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var Protocol = nrpc.Protocol(nil)
var RootContext = actor.EmptyRootContext
Functions ¶
func C2S_Promise_MessageID ¶
func C2S_Promise_MessageName ¶
func C2S_Promise_MessageName() string
func DefaultDecider ¶
func ForwardToChildren ¶
func IsPIDPtrEmpty ¶
func IsPIDValueEmpty ¶
func Put_C2S_Promise ¶
func Put_C2S_Promise(i interface{})
func Put_S2C_Promise ¶
func Put_S2C_Promise(i interface{})
func RequestFuture ¶
func S2C_Promise_MessageID ¶
func S2C_Promise_MessageName ¶
func S2C_Promise_MessageName() string
Types ¶
type Actor ¶
type Actor struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func New ¶
func New(optionFuncs ...OptionFunc) *Actor
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Actor) Debug ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Actor) DispatchEvent ¶
func (*Actor) GetLogic ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (Actor) HttpServerListener ¶
func (Actor) IsStopping ¶
func (Actor) Logger ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Actor) NewHttpTask ¶
func (a *Actor) NewHttpTask(timeout time.Duration, tag HttpTaskTag, prepare OnHttpTaskPrepare, callback OnHttpTaskCompleted) (taskID HttpTaskID, err error)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Actor) NewLoopTimer ¶
func (*Actor) NewPromise ¶
func (*Actor) NewRPCPromise ¶
func (*Actor) NewTimer ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (Actor) PID ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Actor) PoisonAndWait ¶
func (Actor) PromiseNum ¶
func (*Actor) Receive ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Actor) RegisterEventHandler ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Actor) RegisterHttpRequestHandler ¶
func (a *Actor) RegisterHttpRequestHandler(pattern string, fn http.HandlerFunc, option *HttpRequestHandlerOption) (err error)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Actor) RegisterMessageHandler ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Actor) RegisterRPCHandler ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (Actor) Sign ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Actor) Start ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Actor) StopAndWait ¶
func (*Actor) WaitForStarted ¶
func (a *Actor) WaitForStarted()
func (*Actor) WaitForStopped ¶
func (a *Actor) WaitForStopped()
type C2S_Promise ¶
type C2S_Promise struct { ///序列 Seq uint64 `protobuf:"varint,1,opt,name=Seq,proto3" json:"Seq,omitempty"` ///请求消息id ReqMsgID uint32 `protobuf:"varint,2,opt,name=ReqMsgID,proto3" json:"ReqMsgID,omitempty"` ///请求消息数据 ReqMsgData []byte `protobuf:"bytes,3,opt,name=ReqMsgData,proto3" json:"ReqMsgData,omitempty"` }
/ 异步请求 @id=1
func Get_C2S_Promise ¶
func Get_C2S_Promise() *C2S_Promise
func New_C2S_Promise ¶
func New_C2S_Promise() *C2S_Promise
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// message C2S_Promise begin
func (*C2S_Promise) Clone ¶
func (m *C2S_Promise) Clone() *C2S_Promise
func (*C2S_Promise) Descriptor ¶
func (*C2S_Promise) Descriptor() ([]byte, []int)
func (*C2S_Promise) Equal ¶
func (this *C2S_Promise) Equal(that interface{}) bool
func (*C2S_Promise) GetReqMsgData ¶
func (m *C2S_Promise) GetReqMsgData() []byte
func (*C2S_Promise) GetReqMsgID ¶
func (m *C2S_Promise) GetReqMsgID() uint32
func (*C2S_Promise) GetSeq ¶
func (m *C2S_Promise) GetSeq() uint64
func (*C2S_Promise) GoString ¶
func (this *C2S_Promise) GoString() string
func (*C2S_Promise) Marshal ¶
func (m *C2S_Promise) Marshal() (dAtA []byte, err error)
func (*C2S_Promise) MarshalToSizedBuffer ¶
func (m *C2S_Promise) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (C2S_Promise) MessageID ¶
func (C2S_Promise) MessageID() rpc.MessageID
func (C2S_Promise) MessageName ¶
func (C2S_Promise) MessageName() string
func (*C2S_Promise) ProtoMessage ¶
func (*C2S_Promise) ProtoMessage()
func (C2S_Promise) RPC ¶
func (C2S_Promise) RPC()
func (*C2S_Promise) Reset ¶
func (m *C2S_Promise) Reset()
func (*C2S_Promise) ResetEx ¶
func (m *C2S_Promise) ResetEx()
func (C2S_Promise) ResponseMessageID ¶
func (C2S_Promise) ResponseMessageID() rpc.MessageID
func (*C2S_Promise) Size ¶
func (m *C2S_Promise) Size() (n int)
func (*C2S_Promise) String ¶
func (this *C2S_Promise) String() string
func (*C2S_Promise) Unmarshal ¶
func (m *C2S_Promise) Unmarshal(dAtA []byte) error
func (*C2S_Promise) XXX_DiscardUnknown ¶
func (m *C2S_Promise) XXX_DiscardUnknown()
func (*C2S_Promise) XXX_Marshal ¶
func (m *C2S_Promise) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*C2S_Promise) XXX_Merge ¶
func (m *C2S_Promise) XXX_Merge(src proto.Message)
func (*C2S_Promise) XXX_Size ¶
func (m *C2S_Promise) XXX_Size() int
func (*C2S_Promise) XXX_Unmarshal ¶
func (m *C2S_Promise) XXX_Unmarshal(b []byte) error
type ErrPromiseMarshalResponseMessageFail ¶
type ErrPromiseMarshalResponseMessageFail struct { Seq PromiseSeq RequestMessageID nrpc.MessageID ResponseMessageID nrpc.MessageID Err error }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (ErrPromiseMarshalResponseMessageFail) Error ¶
func (e ErrPromiseMarshalResponseMessageFail) Error() string
type ErrPromiseNotExist ¶
type ErrPromiseNotExist struct {
Seq PromiseSeq
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (ErrPromiseNotExist) Error ¶
func (e ErrPromiseNotExist) Error() string
type ErrPromiseProduceRequestMessageFail ¶
type ErrPromiseProduceRequestMessageFail struct { Seq PromiseSeq RequestMessageID nrpc.MessageID Err error }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (ErrPromiseProduceRequestMessageFail) Error ¶
func (e ErrPromiseProduceRequestMessageFail) Error() string
type ErrPromiseProduceResponseMessageFail ¶
type ErrPromiseProduceResponseMessageFail struct { Seq PromiseSeq RequestMessageID nrpc.MessageID ResponseMessageID nrpc.MessageID Err error }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (ErrPromiseProduceResponseMessageFail) Error ¶
func (e ErrPromiseProduceResponseMessageFail) Error() string
type ErrPromiseTimeout ¶
type ErrPromiseTimeout struct { Seq PromiseSeq RequestMessageID nrpc.MessageID }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (ErrPromiseTimeout) Error ¶
func (e ErrPromiseTimeout) Error() string
type ErrPromiseUnmarshalRequestMessageFail ¶
type ErrPromiseUnmarshalRequestMessageFail struct { Seq PromiseSeq RequestMessageID nrpc.MessageID Err error }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (ErrPromiseUnmarshalRequestMessageFail) Error ¶
func (e ErrPromiseUnmarshalRequestMessageFail) Error() string
type ErrPromiseUnmarshalResponseMessageFail ¶
type ErrPromiseUnmarshalResponseMessageFail struct { Seq PromiseSeq RequestMessageID nrpc.MessageID ResponseMessageID nrpc.MessageID Err error }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (ErrPromiseUnmarshalResponseMessageFail) Error ¶
func (e ErrPromiseUnmarshalResponseMessageFail) Error() string
type HandlerOptionFunc ¶
type HandlerOptionFunc func(option *HttpRequestHandlerOption)
func WithHttpRequestMinDispatchInterval ¶
func WithHttpRequestMinDispatchInterval(minDispatchInterval time.Duration) HandlerOptionFunc
func WithHttpRequestQueued ¶
func WithHttpRequestQueued(queued bool) HandlerOptionFunc
func WithHttpRequestTimeout ¶
func WithHttpRequestTimeout(timeout time.Duration) HandlerOptionFunc
type HttpRequestHandlerOption ¶
type HttpRequestHandlerOption struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func NewHttpHandlerOption ¶
func NewHttpHandlerOption(optionFuncs ...HandlerOptionFunc) *HttpRequestHandlerOption
func (HttpRequestHandlerOption) MinDispatchInterval ¶
func (o HttpRequestHandlerOption) MinDispatchInterval() time.Duration
func (HttpRequestHandlerOption) Timeout ¶
func (o HttpRequestHandlerOption) Timeout() time.Duration
type HttpTask ¶
type HttpTask struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (HttpTask) GetResponseBodyData ¶
func (HttpTask) ID ¶
func (t HttpTask) ID() HttpTaskID
func (HttpTask) Tag ¶
func (t HttpTask) Tag() HttpTaskTag
type HttpTaskID ¶
type HttpTaskID = uint64
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
type HttpTaskManager ¶
type HttpTaskManager struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func NewHttpTaskManager ¶
func NewHttpTaskManager(pid *actor.PID) *HttpTaskManager
func (*HttpTaskManager) NewTask ¶
func (m *HttpTaskManager) NewTask(timeout time.Duration, tag HttpTaskTag, onPrepare OnHttpTaskPrepare, onCompleted OnHttpTaskCompleted) (taskID HttpTaskID, err error)
func (*HttpTaskManager) OnCompleted ¶
func (m *HttpTaskManager) OnCompleted(id HttpTaskID) (err error)
type HttpTaskTag ¶
type HttpTaskTag = uint64
type IActor ¶
type IActor interface { PID() *actor.PID ParentPID() *actor.PID Sign() string SetSign(sign string) Logger() nlog.ILogger //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Start(ctx actor.Context, name string) (err error) WaitForStarted() IsStopping() bool Stop() error WaitForStopped() StopAndWait() error Poison() error PoisonAndWait() error //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Debug(format string, args ...interface{}) Info(format string, args ...interface{}) Warn(format string, args ...interface{}) Error(format string, args ...interface{}) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// NewTimer(dur time.Duration, tag TimerTag, cb TimerCallback) TimerID NewLoopTimer(dur time.Duration, tag TimerID, cb TimerCallback) TimerID StopTimer(id TimerID) error //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RegisterEventHandler(id nevent.ID, h nevent.Handler) DispatchEvent(iEvent nevent.IEvent, ctx actor.Context, args ...interface{}) (err error) PostEvent(iEvent nevent.IEvent) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// NewHttpTask(timeout time.Duration, tag HttpTaskTag, prepare OnHttpTaskPrepare, callback OnHttpTaskCompleted) (taskID HttpTaskID, err error) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RegisterRPCHandler(id nrpc.MessageID, handler nrpc.MessageHandler) (err error) NewPromise() (promise *Promise) NewRPCPromise(iRequestMessage nrpc.IMessage, receiver *actor.PID, cb PromiseCallback) (promise *Promise) PromiseNum() int //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RegisterMessageHandler(id npb.MessageID, handler npb.MessageHandler) (err error) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RegisterHttpRequestHandler(pattern string, fn http.HandlerFunc, option *HttpRequestHandlerOption) (err error) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// HttpServerListener() net.Listener //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// GetLogic(id nexport.LogicID) nexport.ILogic EachLogic(fn func(id nexport.LogicID, logic nexport.ILogic) (continued bool)) }
type IPromiseTask ¶
type IPromiseTask interface { Promise() *Promise Next() IPromiseTask SetNext(next IPromiseTask) }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
type OnHttpTaskCompleted ¶
type OnHttpTaskPrepare ¶
type OptionFunc ¶
type OptionFunc func(option *option)
func WithDecider ¶
func WithDecider(decider actor.DeciderFunc) OptionFunc
func WithEvent ¶
func WithEvent(before VFBeforeDispatchEvent, after VFAfterDispatchEvent) OptionFunc
func WithHttpServer ¶
func WithHttpServer(listenAddr string, certFile string, keyFile string, afterRun VFAfterRunHttpServer, beforeDispatch VFBeforeDispatchHttpRequest, afterDispatch VFAfterDispatchHttpRequest) OptionFunc
func WithHttpTask ¶
func WithHttpTask(before VFBeforeCompleteHttpTask, after VFAfterCompleteHttpTask) OptionFunc
func WithLogger ¶
func WithLogger(logger nlog.ILogger) OptionFunc
func WithLogics ¶
func WithLogics(logics map[nexport.LogicID]nexport.ILogic) OptionFunc
func WithMailBoxSize ¶
func WithMailBoxSize(mailBoxSize int) OptionFunc
func WithMessage ¶
func WithMessage(iProtocol npb.IProtocol, before VFBeforeDispatchMessage, after VFAfterDispatchMessage) OptionFunc
func WithOnActorTerminate ¶
func WithOnActorTerminate(vf VFOnActorTerminated) OptionFunc
func WithOnReceiveMessage ¶
func WithOnReceiveMessage(vf VFOnReceiveMessage) OptionFunc
func WithOnRestarted ¶
func WithOnRestarted(vf VFOnRestarted) OptionFunc
func WithOnRestarting ¶
func WithOnRestarting(vf VFOnRestarting) OptionFunc
func WithOnStarted ¶
func WithOnStarted(vf VFOnStarted) OptionFunc
func WithOnStopped ¶
func WithOnStopped(vf VFOnStopped) OptionFunc
func WithOnStopping ¶
func WithOnStopping(vf VFOnStopping) OptionFunc
func WithRPC ¶
func WithRPC(iProtocol nrpc.IProtocol, before VFBeforeDispatchRPC, after VFAfterDispatchRPC) OptionFunc
func WithStartedWaitGroup ¶
func WithStartedWaitGroup(startedWg *sync.WaitGroup) OptionFunc
func WithStoppedWaitGroup ¶
func WithStoppedWaitGroup(stoppedWg *sync.WaitGroup) OptionFunc
func WithTimer ¶
func WithTimer(before VFBeforeTriggerTimer, after VFAfterTriggerTimer) OptionFunc
type Promise ¶
type Promise struct { *PromiseContext // contains filtered or unexported fields }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Promise) OnComplete ¶
func (p *Promise) OnComplete(cb PromiseOnCompleted) *Promise
func (*Promise) Then ¶
func (p *Promise) Then(cb PromiseCallback) *Promise
type PromiseCallback ¶
type PromiseCallback = func(ctx *PromiseContext)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
type PromiseContext ¶
type PromiseContext struct {
// contains filtered or unexported fields
}
func (*PromiseContext) Error ¶
func (p *PromiseContext) Error() error
func (PromiseContext) Receiver ¶
func (p PromiseContext) Receiver() *actor.PID
func (PromiseContext) RequestMessage ¶
func (p PromiseContext) RequestMessage() nrpc.IMessage
func (PromiseContext) Requested ¶
func (p PromiseContext) Requested() bool
func (PromiseContext) ResponseMessage ¶
func (p PromiseContext) ResponseMessage() nrpc.IMessage
func (PromiseContext) Seq ¶
func (p PromiseContext) Seq() PromiseSeq
func (*PromiseContext) SetError ¶
func (p *PromiseContext) SetError(err error)
func (*PromiseContext) SetReceiver ¶
func (p *PromiseContext) SetReceiver(receiver *actor.PID)
func (*PromiseContext) SetRequestMessage ¶
func (p *PromiseContext) SetRequestMessage(iRequestMessage nrpc.IMessage)
func (*PromiseContext) SetRequested ¶
func (p *PromiseContext) SetRequested(requested bool)
func (*PromiseContext) SetResponseMessage ¶
func (p *PromiseContext) SetResponseMessage(iResponseMessage nrpc.IMessage)
type PromiseOnCompleted ¶
type PromiseOnCompleted = func(err error, ctx *PromiseContext)
type PromiseSeq ¶
type PromiseSeq = uint64
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
type S2C_Promise ¶
type S2C_Promise struct { ///序列 Seq uint64 `protobuf:"varint,1,opt,name=Seq,proto3" json:"Seq,omitempty"` ///回复消息id RespMsgID uint32 `protobuf:"varint,2,opt,name=RespMsgID,proto3" json:"RespMsgID,omitempty"` ///回复消息数据 RespMsgData []byte `protobuf:"bytes,3,opt,name=RespMsgData,proto3" json:"RespMsgData,omitempty"` }
/ 异步回复 @id=2
func Get_S2C_Promise ¶
func Get_S2C_Promise() *S2C_Promise
func New_S2C_Promise ¶
func New_S2C_Promise() *S2C_Promise
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// message S2C_Promise begin
func (*S2C_Promise) Clone ¶
func (m *S2C_Promise) Clone() *S2C_Promise
func (*S2C_Promise) Descriptor ¶
func (*S2C_Promise) Descriptor() ([]byte, []int)
func (*S2C_Promise) Equal ¶
func (this *S2C_Promise) Equal(that interface{}) bool
func (*S2C_Promise) GetRespMsgData ¶
func (m *S2C_Promise) GetRespMsgData() []byte
func (*S2C_Promise) GetRespMsgID ¶
func (m *S2C_Promise) GetRespMsgID() uint32
func (*S2C_Promise) GetSeq ¶
func (m *S2C_Promise) GetSeq() uint64
func (*S2C_Promise) GoString ¶
func (this *S2C_Promise) GoString() string
func (*S2C_Promise) Marshal ¶
func (m *S2C_Promise) Marshal() (dAtA []byte, err error)
func (*S2C_Promise) MarshalToSizedBuffer ¶
func (m *S2C_Promise) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (S2C_Promise) MessageID ¶
func (S2C_Promise) MessageID() rpc.MessageID
func (S2C_Promise) MessageName ¶
func (S2C_Promise) MessageName() string
func (*S2C_Promise) ProtoMessage ¶
func (*S2C_Promise) ProtoMessage()
func (S2C_Promise) RPC ¶
func (S2C_Promise) RPC()
func (*S2C_Promise) Reset ¶
func (m *S2C_Promise) Reset()
func (*S2C_Promise) ResetEx ¶
func (m *S2C_Promise) ResetEx()
func (S2C_Promise) ResponseMessageID ¶
func (S2C_Promise) ResponseMessageID() rpc.MessageID
func (*S2C_Promise) Size ¶
func (m *S2C_Promise) Size() (n int)
func (*S2C_Promise) String ¶
func (this *S2C_Promise) String() string
func (*S2C_Promise) Unmarshal ¶
func (m *S2C_Promise) Unmarshal(dAtA []byte) error
func (*S2C_Promise) XXX_DiscardUnknown ¶
func (m *S2C_Promise) XXX_DiscardUnknown()
func (*S2C_Promise) XXX_Marshal ¶
func (m *S2C_Promise) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*S2C_Promise) XXX_Merge ¶
func (m *S2C_Promise) XXX_Merge(src proto.Message)
func (*S2C_Promise) XXX_Size ¶
func (m *S2C_Promise) XXX_Size() int
func (*S2C_Promise) XXX_Unmarshal ¶
func (m *S2C_Promise) XXX_Unmarshal(b []byte) error
type TimerCallback ¶
type TimerManager ¶
type TimerManager struct {
// contains filtered or unexported fields
}
func NewTimerManager ¶
func NewTimerManager(pid *actor.PID) *TimerManager
func (*TimerManager) NewLoopTimer ¶
func (m *TimerManager) NewLoopTimer(dur time.Duration, callback TimerCallback) TimerID
func (*TimerManager) NewLoopTimerWithTag ¶
func (m *TimerManager) NewLoopTimerWithTag(dur time.Duration, tag TimerTag, callback TimerCallback) TimerID
func (*TimerManager) NewTimer ¶
func (m *TimerManager) NewTimer(dur time.Duration, callback TimerCallback) TimerID
func (*TimerManager) NewTimerWithTag ¶
func (m *TimerManager) NewTimerWithTag(dur time.Duration, tag TimerTag, callback TimerCallback) TimerID
func (*TimerManager) Stop ¶
func (m *TimerManager) Stop(id TimerID) error
func (*TimerManager) StopAll ¶
func (m *TimerManager) StopAll()
func (*TimerManager) Trigger ¶
func (m *TimerManager) Trigger(id TimerID) error
type VFAfterCompleteHttpTask ¶
type VFAfterCompleteHttpTask func(err error, id HttpTaskID, tag HttpTaskTag, ctx actor.Context)
type VFAfterDispatchEvent ¶
type VFAfterDispatchMessage ¶
type VFAfterDispatchRPC ¶
type VFAfterRunHttpServer ¶
type VFAfterRunHttpServer func(err error)
type VFAfterTriggerTimer ¶
type VFBeforeCompleteHttpTask ¶
type VFBeforeCompleteHttpTask func(id HttpTaskID, tag HttpTaskTag, ctx actor.Context) (ok bool, err error)
type VFBeforeDispatchEvent ¶
type VFBeforeDispatchMessage ¶
type VFBeforeDispatchRPC ¶
type VFBeforeTriggerTimer ¶
type VFOnReceiveMessage ¶
type VFOnRestarted ¶
type VFOnRestarting ¶
type VFOnStarted ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////