Documentation ¶
Index ¶
Constants ¶
View Source
const ( PH = 0 SizeofMessageID = 2 SizeofMessageSeq = 4 SizeofMessageHead = SizeofMessageID + SizeofMessageSeq )
Variables ¶
View Source
var (
ByteOrder = binary.LittleEndian // 小端
)
Functions ¶
This section is empty.
Types ¶
type IMessage ¶
type IMessage interface { proto.Message V3() Head() MessageHead SetMessageSeq(seq MessageSeq) ResponseMessageID() MessageID Size() int MarshalTo([]byte) (int, error) Unmarshal([]byte) error ResetEx() Once() bool MinInterval() time.Duration }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
type IMessageDispatcher ¶
type IMessageDispatcher interface { Register(id MessageID, handler MessageHandler) (err error) Dispatch(iRecv IMessage, iSend IMessage, ctx actor.Context, args ...interface{}) (err error) }
func NewMessageDispatcher ¶
func NewMessageDispatcher() IMessageDispatcher
type IMessageFactoryManager ¶
type IMessageFactoryManager interface { Register(messageID MessageID, iMsg IMessage, producer messageProducer, recycler messageRecycler, once bool, minInterval time.Duration) Produce(id MessageID) (IMessage, error) Recycle(iMsg IMessage) error ReflectType(id MessageID) reflect.Type }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func NewMessageFactoryManager ¶
func NewMessageFactoryManager() IMessageFactoryManager
type IProtocol ¶
type IProtocol interface { IMessageFactoryManager Alloc(size int) []byte Free(buffer []byte) Encrypt(data []byte) (err error) Decrypt(data []byte) (err error) EncodeTo(iMsg IMessage, data []byte) (err error) Encode(iMsg IMessage) (data []byte, err error) Decode(data []byte) (iMsg IMessage, err error) }
func New ¶
func New(allocator p.IAllocator, encryptor p.IEncryptor, decryptor p.IDecryptor) IProtocol
type MessageBroker ¶
type MessageBroker struct {
// contains filtered or unexported fields
}
func NewMessageBroker ¶
func NewMessageBroker() *MessageBroker
func (*MessageBroker) CanAccept ¶
func (b *MessageBroker) CanAccept(iRecv IMessage) (err error)
type MessageHandler ¶
type MessageHead ¶
type MessageHead struct { MessageID MessageID MessageSeq MessageSeq }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
type MessageSeq ¶
type MessageSeq = uint32
Click to show internal directories.
Click to hide internal directories.