message

package
v0.0.0-...-27cef4d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: LGPL-3.0 Imports: 5 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLength         = errors.New("invalid length")
	ErrAlreadyAppliedMessage = errors.New("already applied message")
	ErrNotAppliedMessage     = errors.New("not applied message")
	ErrUnhandledMessage      = errors.New("unhandled message")
	ErrInvalidMessage        = errors.New("invalid message")
	ErrUnknownMessage        = errors.New("unknown message")
)

message error list

Functions

func NameOfType

func NameOfType(t Type) string

NameOfType returns the name of the type

Types

type Creator

type Creator func(r io.Reader, mt Type) (Message, error)

Creator is a message creator function type

type Manager

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

Manager is a structure that stores data for message processing.

func NewManager

func NewManager() *Manager

NewManager returns a Manager

func (*Manager) DeleteMessage

func (mm *Manager) DeleteMessage(m Type) error

DeleteMessage deletes registered messageMap.

func (*Manager) ParseMessage

func (mm *Manager) ParseMessage(r io.Reader, mt Type) (Message, error)

ParseMessage receives the data stream as a Reader and processes them through the creator and returns the message.

func (*Manager) SetCreator

func (mm *Manager) SetCreator(mt Type, c Creator) error

SetCreator is a function to register a message. Register author and handler by type to use when receiving messageMap.

type Message

type Message interface {
	io.WriterTo
	io.ReaderFrom
	Type() Type
}

Message is a message for communicating between services

type Sender

type Sender interface {
	Send(m Message) error
}

Sender is Default function of messenger

type Type

type Type uint64

Type is message type

func DefineType

func DefineType(Name string) Type

DefineType is return string type

Jump to

Keyboard shortcuts

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