rpc

package
v0.0.0-...-bac99df Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PH = 0
)

Variables

View Source
var (
	ErrInvalidLengthProto = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowProto   = fmt.Errorf("proto: integer overflow")
)

Functions

func C2S_Promise_MessageName

func C2S_Promise_MessageName() string

func Put_C2S_Promise

func Put_C2S_Promise(i interface{})

func Put_S2C_Promise

func Put_S2C_Promise(i interface{})

func S2C_Promise_MessageName

func S2C_Promise_MessageName() string

Types

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"`
}

/ 异步请求 @msg=1

func Clone_C2S_Promise_Slice

func Clone_C2S_Promise_Slice(dst []*C2S_Promise, src []*C2S_Promise) []*C2S_Promise

func Get_C2S_Promise

func Get_C2S_Promise() *C2S_Promise

func New_C2S_Promise

func New_C2S_Promise() *C2S_Promise

func (C2S_Promise) CanIgnore

func (C2S_Promise) CanIgnore() bool

func (C2S_Promise) Clone

func (m C2S_Promise) Clone() *C2S_Promise

func (*C2S_Promise) Descriptor

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

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) JsonString

func (m C2S_Promise) JsonString() string

func (*C2S_Promise) Marshal

func (m *C2S_Promise) Marshal() (dAtA []byte, err error)

func (*C2S_Promise) MarshalTo

func (m *C2S_Promise) MarshalTo(dAtA []byte) (int, error)

func (C2S_Promise) MessageID

func (C2S_Promise) MessageID() 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()

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// message C2S_Promise begin

func (C2S_Promise) ResponseMessageID

func (C2S_Promise) ResponseMessageID() MessageID

func (*C2S_Promise) Size

func (m *C2S_Promise) Size() (n int)

func (*C2S_Promise) String

func (m *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  MessageID
	ResponseMessageID MessageID
	Err               error
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func (ErrPromiseMarshalResponseMessageFail) Error

type ErrPromiseNotExist

type ErrPromiseNotExist struct {
	Seq PromiseSeq
}

func (ErrPromiseNotExist) Error

func (e ErrPromiseNotExist) Error() string

type ErrPromiseProduceRequestMessageFail

type ErrPromiseProduceRequestMessageFail struct {
	Seq              PromiseSeq
	RequestMessageID MessageID
	Err              error
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func (ErrPromiseProduceRequestMessageFail) Error

type ErrPromiseProduceResponseMessageFail

type ErrPromiseProduceResponseMessageFail struct {
	Seq               PromiseSeq
	RequestMessageID  MessageID
	ResponseMessageID MessageID
	Err               error
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func (ErrPromiseProduceResponseMessageFail) Error

type ErrPromiseTimeout

type ErrPromiseTimeout struct {
	Seq              PromiseSeq
	RequestMessageID MessageID
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func (ErrPromiseTimeout) Error

func (e ErrPromiseTimeout) Error() string

type ErrPromiseUnmarshalRequestMessageFail

type ErrPromiseUnmarshalRequestMessageFail struct {
	Seq              PromiseSeq
	RequestMessageID MessageID
	Err              error
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func (ErrPromiseUnmarshalRequestMessageFail) Error

type ErrPromiseUnmarshalResponseMessageFail

type ErrPromiseUnmarshalResponseMessageFail struct {
	Seq               PromiseSeq
	RequestMessageID  MessageID
	ResponseMessageID MessageID
	Err               error
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func (ErrPromiseUnmarshalResponseMessageFail) Error

type IMessage

type IMessage interface {
	proto.Message
	Size() int
	Marshal() (dAtA []byte, err error)
	Unmarshal([]byte) error
	RPC()
	MessageID() MessageID
	MessageName() string
	ResetEx()
	JsonString() string
	ResponseMessageID() MessageID
	CanIgnore() bool
}

func RequestFuture

func RequestFuture(pid *actor.PID, send IMessage, timeout time.Duration) (IMessage, error)

type IMessageDispatcher

type IMessageDispatcher interface {
	IPromiseManager
	MustRegister(id MessageID, handler MessageHandler)
	Dispatch(iProtocol IProtocol, sender *actor.PID, iRecv IMessage, ctx actor.Context, args ...interface{}) error
}

func NewMessageDispatcher

func NewMessageDispatcher() IMessageDispatcher

type IMessageFactoryManager

type IMessageFactoryManager interface {
	Register(iMsg IMessage, producer messageProducer, recycler messageRecycler)
	Produce(id MessageID) (IMessage, error)
	Recycle(iMsg IMessage) error
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

type IPromiseManager

type IPromiseManager interface {
	ExecutePromise(promise *Promise)
	CheckAndRemovePromiseTimer(timerID mactor.TimerID, timerTag mactor.TimerID)
	PromiseNum() int
}

type IProtocol

type IProtocol interface {
	IMessageFactoryManager
}

func New

func New(allocator p.IAllocator) IProtocol

type MessageHandler

type MessageHandler func(sender *actor.PID, iRecv IMessage, ctx actor.Context, args ...interface{})

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

type MessageID

type MessageID = uint32

func C2S_Promise_MessageID

func C2S_Promise_MessageID() MessageID

func C2S_Promise_ResponseMessageID

func C2S_Promise_ResponseMessageID() MessageID

func S2C_Promise_MessageID

func S2C_Promise_MessageID() MessageID

func S2C_Promise_ResponseMessageID

func S2C_Promise_ResponseMessageID() MessageID

type Promise

type Promise struct {
	*PromiseContext
	// contains filtered or unexported fields
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func NewPromise

func NewPromise() *Promise

func (*Promise) Add

func (p *Promise) Add(child *Promise) *Promise

func (*Promise) Execute

func (p *Promise) Execute()

func (*Promise) OnComplete

func (p *Promise) OnComplete(cb PromiseOnComplete) *Promise

func (*Promise) Then

func (p *Promise) Then(cb PromiseCallback) *Promise

func (*Promise) WithRequest

func (p *Promise) WithRequest(sender *actor.PID, iReqMsg IMessage, receiver *actor.PID, cb PromiseCallback) *Promise

func (*Promise) WithTimeout

func (p *Promise) WithTimeout(timeout time.Duration) *Promise

type PromiseCallback

type PromiseCallback = func(promise *Promise)

type PromiseContext

type PromiseContext struct {
	Sender           *actor.PID
	IRequestMessage  IMessage
	Receiver         *actor.PID
	IResponseMessage IMessage
	Requested        bool
	Err              error
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

type PromiseOnComplete

type PromiseOnComplete = func(err error)

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"`
}

/ 异步回复 @msg=2

func Clone_S2C_Promise_Slice

func Clone_S2C_Promise_Slice(dst []*S2C_Promise, src []*S2C_Promise) []*S2C_Promise

func Get_S2C_Promise

func Get_S2C_Promise() *S2C_Promise

func New_S2C_Promise

func New_S2C_Promise() *S2C_Promise

func Request_S2C_Promise

func Request_S2C_Promise(pid *actor.PID, send *C2S_Promise) (*S2C_Promise, error)

func Request_S2C_Promise_T

func Request_S2C_Promise_T(pid *actor.PID, send *C2S_Promise, timeout time.Duration) (*S2C_Promise, error)

func (S2C_Promise) CanIgnore

func (S2C_Promise) CanIgnore() bool

func (S2C_Promise) Clone

func (m S2C_Promise) Clone() *S2C_Promise

func (*S2C_Promise) Descriptor

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

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) JsonString

func (m S2C_Promise) JsonString() string

func (*S2C_Promise) Marshal

func (m *S2C_Promise) Marshal() (dAtA []byte, err error)

func (*S2C_Promise) MarshalTo

func (m *S2C_Promise) MarshalTo(dAtA []byte) (int, error)

func (S2C_Promise) MessageID

func (S2C_Promise) MessageID() 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()

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// message S2C_Promise begin

func (S2C_Promise) ResponseMessageID

func (S2C_Promise) ResponseMessageID() MessageID

func (*S2C_Promise) Size

func (m *S2C_Promise) Size() (n int)

func (*S2C_Promise) String

func (m *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

Jump to

Keyboard shortcuts

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