transmit

package
v0.0.0-...-1be2d7f Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// FragmentSizeLength is the length of the encoded size of a message
	FragmentSizeLength = 4
)

Functions

func DecodeRead

func DecodeRead(conn net.Conn, obj Serializable) (err error)

DecodeRead tries to decode a serialized object that was encoded via the Iterum defaults as described in `transmit.Encode` and Read from the passed connection

func EncodeSend

func EncodeSend(conn net.Conn, obj Serializable) (err error)

EncodeSend encodes a serializable object via the Iterum defaults:

unsigned 32bit int msg length , followed by the encoded object

Then it sends it on the target connection

Types

type ConnectionError

type ConnectionError struct {
	Err error
}

ConnectionError is raised when something with net.Conn fails (such as reading or writing)

func ErrConnection

func ErrConnection(err error) *ConnectionError

ErrConnection is used to raise a ConnectionError embedding another error

func (ConnectionError) Error

func (err ConnectionError) Error() string

func (*ConnectionError) Unwrap

func (err *ConnectionError) Unwrap() error

type Serializable

type Serializable interface {
	Serialize() ([]byte, error)
	Deserialize([]byte) error
}

Serializable is an interface describing structures that can be encoded and decoded

type SerializationError

type SerializationError struct {
	Err error
}

SerializationError is raised when serialize or deserialize fails

func ErrSerialization

func ErrSerialization(err error) *SerializationError

ErrSerialization is used to raise a SerializationError embedding another error

func (*SerializationError) Error

func (err *SerializationError) Error() string

func (*SerializationError) Unwrap

func (err *SerializationError) Unwrap() error

Jump to

Keyboard shortcuts

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