gamqp/amqp091/internal/frame

AMQP 0-9-1 framing: method, content header, body and heartbeat frames.

Types

pub type DecodeError {
  Incomplete
  ProtocolHeader
  Malformed(String)
}

Constructors

  • Incomplete

    The buffer holds less than one whole frame.

  • ProtocolHeader

    The broker sent its own protocol header: it does not speak 0-9-1.

  • Malformed(String)
pub type Frame {
  MethodFrame(channel: Int, method: method.Method)
  HeaderFrame(
    channel: Int,
    class_id: Int,
    body_size: Int,
    properties: message.Properties,
  )
  BodyFrame(channel: Int, payload: BitArray)
  Heartbeat
}

Constructors

  • MethodFrame(channel: Int, method: method.Method)
  • HeaderFrame(
      channel: Int,
      class_id: Int,
      body_size: Int,
      properties: message.Properties,
    )
  • BodyFrame(channel: Int, payload: BitArray)
  • Heartbeat

Values

pub fn content(
  channel: Int,
  m: method.Method,
  props: message.Properties,
  body: BitArray,
  frame_max: Int,
) -> List(Frame)

The frames carrying one content-bearing method, with the body split so that no frame exceeds frame_max bytes (0 means unlimited).

pub fn decode(
  buffer: BitArray,
) -> Result(#(Frame, BitArray), DecodeError)

Decodes the first frame in buffer and returns it with the unread rest.

pub fn encode(frame: Frame) -> Result(BitArray, String)
pub const overhead: Int

Type, channel and size fields plus the frame-end octet.

pub const protocol_header: BitArray
✨ Search Document