remote

package
v0.0.0-...-b2a5a1f Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RpcCategoryCast = int8(iota)
	RpcCategoryCall
)

Variables

View Source
var (
	ErrMustProtoMessage = errors.New("must be protobuf v2 message")
)
View Source
var File_core_remote_remote_proto protoreflect.FileDescriptor

Functions

func Deserialize

func Deserialize(in []byte) (any, error)

func Serialize

func Serialize(msg any) ([]byte, error)

Types

type Codec

type Codec struct{}

func (Codec) Decode

func (c Codec) Decode(in []byte) (target, sender *actor.PID, msg any, err error)

func (Codec) Encode

func (c Codec) Encode(pid, sender *actor.PID, msg any) ([]byte, error)

Encode 编码

type ConnMap

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

func NewConnMap

func NewConnMap(_remote *Remote) *ConnMap

func (*ConnMap) Get

func (rc *ConnMap) Get(t *actor.PID) rpc.IClient

func (*ConnMap) Load

func (rc *ConnMap) Load(t *actor.PID) rpc.IClient

type IRequest

type IRequest interface {
	Response(msg any) error
	Return()
}

type IResponse

type IResponse interface {
	Response(out []byte) error
	Return()
	Category() int8
}

type ISerializer

type ISerializer interface {
	Serialize(msg any) ([]byte, error)                   // 序列化
	Deserialize(fullName string, in []byte) (any, error) //反序列化
	FullName(msg any) (string, error)                    //获取传输协议消息体全剧唯一完整名称
}

ISerializer 传输协议消息序列化解释器

type MessageEnvelope

type MessageEnvelope struct {
	Target *actor.PID `protobuf:"bytes,1,opt,name=Target,proto3" json:"Target,omitempty"` //receiver
	Sender *actor.PID `protobuf:"bytes,2,opt,name=Sender,proto3" json:"Sender,omitempty"`
	Data   []byte     `protobuf:"bytes,4,opt,name=Data,proto3" json:"Data,omitempty"`
	// contains filtered or unexported fields
}

func (*MessageEnvelope) Descriptor deprecated

func (*MessageEnvelope) Descriptor() ([]byte, []int)

Deprecated: Use MessageEnvelope.ProtoReflect.Descriptor instead.

func (*MessageEnvelope) GetData

func (x *MessageEnvelope) GetData() []byte

func (*MessageEnvelope) GetSender

func (x *MessageEnvelope) GetSender() *actor.PID

func (*MessageEnvelope) GetTarget

func (x *MessageEnvelope) GetTarget() *actor.PID

func (*MessageEnvelope) ProtoMessage

func (*MessageEnvelope) ProtoMessage()

func (*MessageEnvelope) ProtoReflect

func (x *MessageEnvelope) ProtoReflect() protoreflect.Message

func (*MessageEnvelope) Reset

func (x *MessageEnvelope) Reset()

func (*MessageEnvelope) String

func (x *MessageEnvelope) String() string

type Process

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

func (*Process) Call

func (p *Process) Call(ctx context.Context, pid *actor.PID, msg any) (any, error)

func (*Process) Cast

func (p *Process) Cast(pid *actor.PID, msg any)

func (*Process) CastSystem

func (p *Process) CastSystem(_ *actor.PID, msg any)

func (*Process) GracefulStop

func (p *Process) GracefulStop()

func (*Process) Stop

func (p *Process) Stop()

type ProtoSerializer

type ProtoSerializer struct{}

func (ProtoSerializer) Deserialize

func (ps ProtoSerializer) Deserialize(fullName string, bytes []byte) (any, error)

func (ProtoSerializer) FullName

func (ps ProtoSerializer) FullName(msg any) (string, error)

func (ProtoSerializer) Serialize

func (ps ProtoSerializer) Serialize(msg any) ([]byte, error)

type Remote

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

func NewRemote

func NewRemote(e *actor.Engine) (*Remote, error)

func (*Remote) Call

func (r *Remote) Call(ctx context.Context, pid, sender *actor.PID, msg any) (any, error)

func (*Remote) NodeId

func (r *Remote) NodeId() string

func (*Remote) SendMsg

func (r *Remote) SendMsg(pid, sender *actor.PID, msg any) error

type Request

type Request struct {
	Category int8
	Sender   *actor.PID
	Receiver *actor.PID
	Resp     IResponse
	Message  any
}

func (*Request) Do

func (req *Request) Do()

func (*Request) Response

func (req *Request) Response(msg any) error

func (*Request) Return

func (req *Request) Return()

Jump to

Keyboard shortcuts

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