Documentation ¶
Index ¶
- Constants
- Variables
- func AcquireTimer(d time.Duration) *time.Timer
- func ReleaseTimer(t *time.Timer)
- type ActorProcess
- type Config
- type Context
- type Engine
- type IActorBehavior
- type IProcess
- type PID
- func (*PID) Descriptor() ([]byte, []int)deprecated
- func (pid *PID) Equal(other *PID) bool
- func (x *PID) GetAddress() string
- func (x *PID) GetId() string
- func (x *PID) GetNodeId() string
- func (x *PID) GetRequestId() uint32
- func (pid *PID) IsLocal() bool
- func (*PID) ProtoMessage()
- func (x *PID) ProtoReflect() protoreflect.Message
- func (x *PID) Reset()
- func (pid *PID) SendMessage(message interface{})
- func (x *PID) String() string
- type Register
- type Request
- type Response
- type Stop
- type Stopped
- type Stopping
- type SystemGracefulStop
- type SystemRestart
- type SystemStarted
- type SystemStop
Constants ¶
View Source
const ( Call = 1 AsyncCall = 2 )
View Source
const (
BucketNum = 64
)
Variables ¶
View Source
var (
ErrCallTimeout = errors.New("err_call_timeout")
)
View Source
var File_core_actor_actor_proto protoreflect.FileDescriptor
Functions ¶
func ReleaseTimer ¶
Types ¶
type ActorProcess ¶
type ActorProcess struct {
// contains filtered or unexported fields
}
func (*ActorProcess) Cast ¶
func (ap *ActorProcess) Cast(_ *PID, msg any)
func (*ActorProcess) CastSystem ¶
func (ap *ActorProcess) CastSystem(_ *PID, msg any)
func (*ActorProcess) GracefulStop ¶
func (ap *ActorProcess) GracefulStop()
GracefulStop 模式, actor在消耗掉收到sign之前的所有消息之后在安全的Terminate
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (*Context) GracefulStop ¶
GracefulStop 模式, actor在消耗掉收到sign之前的所有消息之后在安全的Terminate
func (*Context) InvokeSysMsg ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) LocalAddress ¶
type IActorBehavior ¶
type IProcess ¶
type IProcess interface { Cast(pid *PID, msg any) CastSystem(pid *PID, msg any) Call(ctx context.Context, pid *PID, msg any) (any, error) Stop() GracefulStop() }
IProcess 每个 Actor 都有一个与之关联的 IProcess 实例, IProcess 负责将消息投递给 Actor 以及 Actor 生命周期管理 IProcess 提供了一个透明的机制来发送消息,使得Local和Remote通信对于 Actor 来说是透明的 业务可以自定义 IProcess 来实现不同的业务场景
func FindProcess ¶
type PID ¶
type PID struct { Address string `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"` NodeId string `protobuf:"bytes,2,opt,name=NodeId,proto3" json:"NodeId,omitempty"` Id string `protobuf:"bytes,3,opt,name=Id,proto3" json:"Id,omitempty"` RequestId uint32 `protobuf:"varint,4,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` // contains filtered or unexported fields }
func NewPID ¶
NewPID returns a new instance of the PID struct. Pid ( Process Id ) 消息投递的入口, 一个可序列化的标识符,作为消息投递的入口,将消息发送到参与者的邮箱; Pid 可以低消耗的序列化供远程传输
func (*PID) Descriptor
deprecated
func (*PID) GetAddress ¶
func (*PID) GetRequestId ¶
func (*PID) ProtoMessage ¶
func (*PID) ProtoMessage()
func (*PID) ProtoReflect ¶
func (x *PID) ProtoReflect() protoreflect.Message
func (*PID) SendMessage ¶
func (pid *PID) SendMessage(message interface{})
type Register ¶
type Register struct {
// contains filtered or unexported fields
}
func NewRegister ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func GetRequest ¶
func GetRequest() *Request
Click to show internal directories.
Click to hide internal directories.