protocol_json

package
v0.0.0-...-83fd405 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PH = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IMessage

type IMessage interface {
	Json()
	MessageID() MessageID
	Unmarshal([]byte) error
	Marshal() ([]byte, error)
	Reset()
	String() string
}

type IMessageFactoryManager

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

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

type IMessageHandlerManager

type IMessageHandlerManager interface {
	Register(id MessageID, handler MessageHandler)
	Process(iMsg IMessage, args ...interface{}) error
}

func NewMessageHandlerManager

func NewMessageHandlerManager() IMessageHandlerManager

type IProtocol

type IProtocol interface {
	IMessageFactoryManager
	Encode(i IMessage) ([]byte, error)
	Decode(data []byte) (IMessage, error)
}

func New

func New(allocator p.IAllocator, encryptor p.IEncryptor, decryptor p.IDecryptor) IProtocol

type MessageHandler

type MessageHandler func(IMessage, ...interface{})

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

type MessageID

type MessageID = string

Jump to

Keyboard shortcuts

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