Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodecI ¶
Codec encodes/decodes various types of messages used within go-micro. ReadHeader and ReadBody are called in pairs to read requests/responses from the connection. Close is called when finished with the connection. ReadBody may be called with a nil argument to force the body to be read and discarded.
type Marshaler ¶
type Marshaler interface { Marshal(interface{}) ([]byte, error) Unmarshal([]byte, interface{}) error String() string }
Marshaler is a simple encoding interface used for the broker/transport where headers are not supported by the underlying implementation.
type Message ¶
type Message struct { Id string Type MessageType Target string Method string Endpoint string Error string // The values read from the socket Header map[string]string Body []byte }
Message represents detailed information about the communication, likely followed by the body. In the case of an error, body may be nil.
type MessageType ¶
type MessageType int32
MessageType x ENUM( Error Request Response Event Unknown )
const ( // MessageTypeError is a MessageType of type Error MessageTypeError MessageType = iota // MessageTypeRequest is a MessageType of type Request MessageTypeRequest // MessageTypeResponse is a MessageType of type Response MessageTypeResponse // MessageTypeEvent is a MessageType of type Event MessageTypeEvent // MessageTypeUnknown is a MessageType of type Unknown MessageTypeUnknown )
func ParseMessage ¶
func ParseMessage(name string) (MessageType, *errorAVA.Error)
ParseMessage attempts to convert a string to a Message
func (MessageType) MarshalText ¶
func (x MessageType) MarshalText() ([]byte, *errorAVA.Error)
MarshalText implements the text marshaller method
func (MessageType) String ¶
func (x MessageType) String() string
String implements the Stringer interface.
func (MessageType) UnmarshalText ¶
func (x MessageType) UnmarshalText(text []byte) (MessageType, *errorAVA.Error)
UnmarshalText implements the text unmarshaller method
type NewCodec ¶
type NewCodec func(io.ReadWriteCloser) CodecI
Takes in a connection/buffer and returns a new Codec