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: 3 modules, 8 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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