Documentation ¶
Overview ¶
Package wrp provides the functionality for converting to and from golang structures into binary wrp messages.
Index ¶
Constants ¶
const ( AuthMessageType = MessageType(2) SimpleRequestResponseMessageType = MessageType(3) SimpleEventMessageType = MessageType(4) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
Decoder represents the underlying ugorji behavior that WRP supports
func NewDecoder ¶
NewDecoder produces a ugorji Decoder using the appropriate WRP configuration for the given format
func NewDecoderBytes ¶
NewDecoderBytes produces a ugorji Decoder using the appropriate WRP configuration for the given format
type Encoder ¶
Encoder represents the underlying ugorji behavior that WRP supports
func NewEncoder ¶
NewEncoder produces a ugorji Encoder using the appropriate WRP configuration for the given format
func NewEncoderBytes ¶
NewEncoderBytes produces a ugorji Encoder using the appropriate WRP configuration for the given format
type Message ¶
type Message struct { Type MessageType `msgpack:"msg_type" json:"-"` Status *int64 `msgpack:"status,omitempty" json:"status,omitempty"` TransactionUUID string `msgpack:"transaction_uuid,omitempty" json:"transaction_uuid,omitempty"` Source string `msgpack:"source,omitempty" json:"source,omitempty"` Destination string `msgpack:"dest,omitempty" json:"dest,omitempty"` Payload []byte `msgpack:"payload,omitempty" json:"payload,omitempty"` }
Message represents a single WRP message. The Type field determines how the other fields are interpreted. For example, if the Type is AuthMessageType, then only Status will be set.
TODO: Type isn't serialized as JSON right now. If it can be serialized without breaking clients, that would simplify the Message mapping tags.
func NewSimpleEvent ¶
NewSimpleEvent is a convenience factory function for creating a simple event message
func NewSimpleRequestResponse ¶
NewSimpleRequestResponse is a convenience factory function for creating a simple request/response message
func (*Message) DeduceType ¶
DeduceType examines the message fields other than Type to determine what the message type is, then sets that type on the message.
This method is a bit of a hack. It allows for formats like JSON where we don't deserialize the type from the message.
type MessageType ¶
type MessageType int64
MessageType indicates the kind of WRP message
func (MessageType) String ¶
func (mt MessageType) String() string