Documentation ¶
Overview ¶
Copyright (C) 2017 Kale Blankenship Portions Copyright (c) Microsoft Corporation
Copyright (C) 2017 Kale Blankenship Portions Copyright (c) Microsoft Corporation
Copyright (C) 2017 Kale Blankenship Portions Copyright (c) Microsoft Corporation
Index ¶
- Constants
- func Marshal(wr *buffer.Buffer, i interface{}) error
- func MarshalComposite(wr *buffer.Buffer, code AMQPType, fields []MarshalField) error
- func PeekMessageType(buf []byte) (uint8, uint8, error)
- func ReadAny(r *buffer.Buffer) (interface{}, error)
- func ReadString(r *buffer.Buffer) (string, error)
- func ReadUbyte(r *buffer.Buffer) (uint8, error)
- func Unmarshal(r *buffer.Buffer, i interface{}) error
- func UnmarshalComposite(r *buffer.Buffer, type_ AMQPType, fields ...UnmarshalField) error
- func ValidateExpiryPolicy(e ExpiryPolicy) error
- func WriteBinary(wr *buffer.Buffer, bin []byte) error
- func WriteDescriptor(wr *buffer.Buffer, code AMQPType)
- type AMQPType
- type Annotations
- type ArrayUByte
- type DeliveryState
- type DescribedType
- type Durability
- type Error
- type ErrorCondition
- type ExpiryPolicy
- type Filter
- type LifetimePolicy
- type MarshalField
- type Milliseconds
- type MultiSymbol
- type NullHandler
- type ReceiverSettleMode
- type Role
- type SASLCode
- type SenderSettleMode
- type StateAccepted
- type StateModified
- type StateReceived
- type StateRejected
- type StateReleased
- type Symbol
- type UUID
- type UnmarshalField
- type Unsettled
Constants ¶
const ( DeleteOnClose = LifetimePolicy(TypeCodeDeleteOnClose) DeleteOnNoLinks = LifetimePolicy(TypeCodeDeleteOnNoLinks) DeleteOnNoMessages = LifetimePolicy(TypeCodeDeleteOnNoMessages) DeleteOnNoLinksOrMessages = LifetimePolicy(TypeCodeDeleteOnNoLinksOrMessages) )
Variables ¶
This section is empty.
Functions ¶
func MarshalComposite ¶
func MarshalComposite(wr *buffer.Buffer, code AMQPType, fields []MarshalField) error
marshalComposite is a helper for us in a composite's marshal() function.
The returned bytes include the composite header and fields. Fields with omit set to true will be encoded as null or omitted altogether if there are no non-null fields after them.
func PeekMessageType ¶
peekMessageType reads the message type without modifying any data.
func Unmarshal ¶
unmarshal decodes AMQP encoded data into i.
The decoding method is based on the type of i.
If i implements unmarshaler, i.Unmarshal() will be called.
Pointers to primitive types will be decoded via the appropriate read[Type] function.
If i is a pointer to a pointer (**Type), it will be dereferenced and a new instance of (*Type) is allocated via reflection.
Common map types (map[string]string, map[Symbol]interface{}, and map[interface{}]interface{}), will be decoded via conversion to the mapStringAny, mapSymbolAny, and mapAnyAny types.
func UnmarshalComposite ¶
func UnmarshalComposite(r *buffer.Buffer, type_ AMQPType, fields ...UnmarshalField) error
unmarshalComposite is a helper for use in a composite's unmarshal() function.
The composite from r will be unmarshaled into zero or more fields. An error will be returned if typ does not match the decoded type.
func ValidateExpiryPolicy ¶
func ValidateExpiryPolicy(e ExpiryPolicy) error
func WriteDescriptor ¶
Types ¶
type AMQPType ¶
type AMQPType uint8
const ( TypeCodeNull AMQPType = 0x40 // Bool TypeCodeBool AMQPType = 0x56 // boolean with the octet 0x00 being false and octet 0x01 being true TypeCodeBoolTrue AMQPType = 0x41 TypeCodeBoolFalse AMQPType = 0x42 // Unsigned TypeCodeUbyte AMQPType = 0x50 // 8-bit unsigned integer (1) TypeCodeUshort AMQPType = 0x60 // 16-bit unsigned integer in network byte order (2) TypeCodeUint AMQPType = 0x70 // 32-bit unsigned integer in network byte order (4) TypeCodeSmallUint AMQPType = 0x52 // unsigned integer value in the range 0 to 255 inclusive (1) TypeCodeUint0 AMQPType = 0x43 // the uint value 0 (0) TypeCodeUlong AMQPType = 0x80 // 64-bit unsigned integer in network byte order (8) TypeCodeSmallUlong AMQPType = 0x53 // unsigned long value in the range 0 to 255 inclusive (1) TypeCodeUlong0 AMQPType = 0x44 // the ulong value 0 (0) // Signed TypeCodeByte AMQPType = 0x51 // 8-bit two's-complement integer (1) TypeCodeShort AMQPType = 0x61 // 16-bit two's-complement integer in network byte order (2) TypeCodeInt AMQPType = 0x71 // 32-bit two's-complement integer in network byte order (4) TypeCodeSmallint AMQPType = 0x54 // 8-bit two's-complement integer (1) TypeCodeLong AMQPType = 0x81 // 64-bit two's-complement integer in network byte order (8) TypeCodeSmalllong AMQPType = 0x55 // 8-bit two's-complement integer // Decimal TypeCodeFloat AMQPType = 0x72 // IEEE 754-2008 binary32 (4) TypeCodeDouble AMQPType = 0x82 // IEEE 754-2008 binary64 (8) TypeCodeDecimal32 AMQPType = 0x74 // IEEE 754-2008 decimal32 using the Binary Integer Decimal encoding (4) TypeCodeDecimal64 AMQPType = 0x84 // IEEE 754-2008 decimal64 using the Binary Integer Decimal encoding (8) TypeCodeDecimal128 AMQPType = 0x94 // IEEE 754-2008 decimal128 using the Binary Integer Decimal encoding (16) // Other TypeCodeChar AMQPType = 0x73 // a UTF-32BE encoded Unicode character (4) TypeCodeTimestamp AMQPType = 0x83 // 64-bit two's-complement integer representing milliseconds since the unix epoch TypeCodeUUID AMQPType = 0x98 // UUID as defined in section 4.1.2 of RFC-4122 // Variable Length TypeCodeVbin8 AMQPType = 0xa0 // up to 2^8 - 1 octets of binary data (1 + variable) TypeCodeVbin32 AMQPType = 0xb0 // up to 2^32 - 1 octets of binary data (4 + variable) TypeCodeStr8 AMQPType = 0xa1 // up to 2^8 - 1 octets worth of UTF-8 Unicode (with no byte order mark) (1 + variable) TypeCodeStr32 AMQPType = 0xb1 // up to 2^32 - 1 octets worth of UTF-8 Unicode (with no byte order mark) (4 +variable) TypeCodeSym8 AMQPType = 0xa3 // up to 2^8 - 1 seven bit ASCII characters representing a symbolic value (1 + variable) TypeCodeSym32 AMQPType = 0xb3 // up to 2^32 - 1 seven bit ASCII characters representing a symbolic value (4 + variable) // Compound TypeCodeList0 AMQPType = 0x45 // the empty list (i.e. the list with no elements) (0) TypeCodeList8 AMQPType = 0xc0 // up to 2^8 - 1 list elements with total size less than 2^8 octets (1 + compound) TypeCodeList32 AMQPType = 0xd0 // up to 2^32 - 1 list elements with total size less than 2^32 octets (4 + compound) TypeCodeMap8 AMQPType = 0xc1 // up to 2^8 - 1 octets of encoded map data (1 + compound) TypeCodeMap32 AMQPType = 0xd1 // up to 2^32 - 1 octets of encoded map data (4 + compound) TypeCodeArray8 AMQPType = 0xe0 // up to 2^8 - 1 array elements with total size less than 2^8 octets (1 + array) TypeCodeArray32 AMQPType = 0xf0 // up to 2^32 - 1 array elements with total size less than 2^32 octets (4 + array) // Composites TypeCodeOpen AMQPType = 0x10 TypeCodeBegin AMQPType = 0x11 TypeCodeAttach AMQPType = 0x12 TypeCodeFlow AMQPType = 0x13 TypeCodeTransfer AMQPType = 0x14 TypeCodeDisposition AMQPType = 0x15 TypeCodeDetach AMQPType = 0x16 TypeCodeEnd AMQPType = 0x17 TypeCodeClose AMQPType = 0x18 TypeCodeSource AMQPType = 0x28 TypeCodeTarget AMQPType = 0x29 TypeCodeError AMQPType = 0x1d TypeCodeMessageHeader AMQPType = 0x70 TypeCodeDeliveryAnnotations AMQPType = 0x71 TypeCodeMessageAnnotations AMQPType = 0x72 TypeCodeMessageProperties AMQPType = 0x73 TypeCodeApplicationProperties AMQPType = 0x74 TypeCodeApplicationData AMQPType = 0x75 TypeCodeAMQPSequence AMQPType = 0x76 TypeCodeAMQPValue AMQPType = 0x77 TypeCodeStateReceived AMQPType = 0x23 TypeCodeStateAccepted AMQPType = 0x24 TypeCodeStateRejected AMQPType = 0x25 TypeCodeStateReleased AMQPType = 0x26 TypeCodeStateModified AMQPType = 0x27 TypeCodeSASLMechanism AMQPType = 0x40 TypeCodeSASLInit AMQPType = 0x41 TypeCodeSASLChallenge AMQPType = 0x42 TypeCodeSASLResponse AMQPType = 0x43 TypeCodeSASLOutcome AMQPType = 0x44 TypeCodeDeleteOnClose AMQPType = 0x2b TypeCodeDeleteOnNoLinks AMQPType = 0x2c TypeCodeDeleteOnNoMessages AMQPType = 0x2d TypeCodeDeleteOnNoLinksOrMessages AMQPType = 0x2e )
Type codes
type Annotations ¶
type Annotations map[interface{}]interface{}
Annotations keys must be of type string, int, or int64.
String keys are encoded as AMQP Symbols.
type ArrayUByte ¶
type ArrayUByte []uint8
ArrayUByte allows encoding []uint8/[]byte as an array rather than binary data.
type DeliveryState ¶
type DeliveryState interface {
// contains filtered or unexported methods
}
DeliveryState encapsulates the various concrete delivery states. http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-delivery-state TODO: http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transactions-v1.0-os.html#type-declared
type DescribedType ¶
type DescribedType struct { Descriptor interface{} Value interface{} }
func (DescribedType) String ¶
func (t DescribedType) String() string
type Durability ¶
type Durability uint32
Durability specifies the durability of a link.
const ( // No terminus state is retained durably. DurabilityNone Durability = 0 // Only the existence and configuration of the terminus is // retained durably. DurabilityConfiguration Durability = 1 // In addition to the existence and configuration of the // terminus, the unsettled state for durable messages is // retained durably. DurabilityUnsettledState Durability = 2 )
Durability Policies
func (*Durability) String ¶
func (d *Durability) String() string
type Error ¶
type Error struct { // A symbolic value indicating the error condition. Condition ErrorCondition // descriptive text about the error condition // // This text supplies any supplementary details not indicated by the condition field. // This text can be logged as an aid to resolving issues. Description string // map carrying information about the error condition Info map[string]interface{} }
Error is an AMQP error.
type ErrorCondition ¶
type ErrorCondition string
ErrorCondition is one of the error conditions defined in the AMQP spec.
type ExpiryPolicy ¶
type ExpiryPolicy Symbol
ExpiryPolicy specifies when the expiry timer of a terminus starts counting down from the timeout value.
If the link is subsequently re-attached before the terminus is expired, then the count down is aborted. If the conditions for the terminus-expiry-policy are subsequently re-met, the expiry timer restarts from its originally configured timeout value.
const ( // The expiry timer starts when terminus is detached. ExpiryLinkDetach ExpiryPolicy = "link-detach" // The expiry timer starts when the most recently // associated session is ended. ExpirySessionEnd ExpiryPolicy = "session-end" // The expiry timer starts when most recently associated // connection is closed. ExpiryConnectionClose ExpiryPolicy = "connection-close" // The terminus never expires. ExpiryNever ExpiryPolicy = "never" )
Expiry Policies
func (*ExpiryPolicy) String ¶
func (e *ExpiryPolicy) String() string
type Filter ¶
type Filter map[Symbol]*DescribedType
type LifetimePolicy ¶
type LifetimePolicy uint8
type MarshalField ¶
type MarshalField struct { Value interface{} // value to be marshaled, use pointers to avoid interface conversion overhead Omit bool // indicates that this field should be omitted (set to null) }
marshalField is a field to be marshaled
type Milliseconds ¶
type NullHandler ¶
type NullHandler func() error
nullHandler is a function to be called when a composite's field is null.
type ReceiverSettleMode ¶
type ReceiverSettleMode uint8
ReceiverSettleMode specifies how the receiver will settle messages.
const ( // Receiver will spontaneously settle all incoming transfers. ModeFirst ReceiverSettleMode = 0 // Receiver will only settle after sending the disposition to the // sender and receiving a disposition indicating settlement of // the delivery from the sender. ModeSecond ReceiverSettleMode = 1 )
Receiver Settlement Modes
func (ReceiverSettleMode) Ptr ¶ added in v1.1.0
func (m ReceiverSettleMode) Ptr() *ReceiverSettleMode
func (*ReceiverSettleMode) String ¶
func (m *ReceiverSettleMode) String() string
type SASLCode ¶
type SASLCode uint8
const ( CodeSASLOK SASLCode = iota // Connection authentication succeeded. CodeSASLAuth // Connection authentication failed due to an unspecified problem with the supplied credentials. CodeSASLSysPerm // Connection authentication failed due to a system error that is unlikely to be corrected without intervention. )
SASL Codes
type SenderSettleMode ¶
type SenderSettleMode uint8
SenderSettleMode specifies how the sender will settle messages.
const ( // Sender will send all deliveries initially unsettled to the receiver. ModeUnsettled SenderSettleMode = 0 // Sender will send all deliveries settled to the receiver. ModeSettled SenderSettleMode = 1 // Sender MAY send a mixture of settled and unsettled deliveries to the receiver. ModeMixed SenderSettleMode = 2 )
Sender Settlement Modes
func (SenderSettleMode) Ptr ¶ added in v1.1.0
func (m SenderSettleMode) Ptr() *SenderSettleMode
func (*SenderSettleMode) String ¶
func (m *SenderSettleMode) String() string
type StateAccepted ¶
type StateAccepted struct{}
func (*StateAccepted) String ¶
func (sa *StateAccepted) String() string
type StateModified ¶
type StateModified struct { // count the transfer as an unsuccessful delivery attempt // // If the delivery-failed flag is set, any messages modified // MUST have their delivery-count incremented. DeliveryFailed bool // prevent redelivery // // If the undeliverable-here is set, then any messages released MUST NOT // be redelivered to the modifying link endpoint. UndeliverableHere bool // message attributes // Map containing attributes to combine with the existing message-annotations // held in the message's header section. Where the existing message-annotations // of the message contain an entry with the same key as an entry in this field, // the value in this field associated with that key replaces the one in the // existing headers; where the existing message-annotations has no such value, // the value in this map is added. MessageAnnotations Annotations }
func (*StateModified) String ¶
func (sm *StateModified) String() string
type StateReceived ¶
type StateReceived struct { // When sent by the sender this indicates the first section of the message // (with section-number 0 being the first section) for which data can be resent. // Data from sections prior to the given section cannot be retransmitted for // this delivery. // // When sent by the receiver this indicates the first section of the message // for which all data might not yet have been received. SectionNumber uint32 // When sent by the sender this indicates the first byte of the encoded section // data of the section given by section-number for which data can be resent // (with section-offset 0 being the first byte). Bytes from the same section // prior to the given offset section cannot be retransmitted for this delivery. // // When sent by the receiver this indicates the first byte of the given section // which has not yet been received. Note that if a receiver has received all of // section number X (which contains N bytes of data), but none of section number // X + 1, then it can indicate this by sending either Received(section-number=X, // section-offset=N) or Received(section-number=X+1, section-offset=0). The state // Received(section-number=0, section-offset=0) indicates that no message data // at all has been transferred. SectionOffset uint64 }
type StateRejected ¶
type StateRejected struct {
Error *Error
}
func (*StateRejected) String ¶
func (sr *StateRejected) String() string
type StateReleased ¶
type StateReleased struct{}
func (*StateReleased) String ¶
func (sr *StateReleased) String() string
type UUID ¶
type UUID [16]byte
UUID is a 128 bit identifier as defined in RFC 4122.
func (UUID) String ¶
String returns the hex encoded representation described in RFC 4122, Section 3.
type UnmarshalField ¶
type UnmarshalField struct { Field interface{} HandleNull NullHandler }
unmarshalField is a struct that contains a field to be unmarshaled into.
An optional nullHandler can be set. If the composite field being unmarshaled is null and handleNull is not nil, nullHandler will be called.