Package: eventstream

import "../ibm-cos-sdk-go-v2/aws/protocol/eventstream"

Sub-Packages

eventstreamapi

Type Summary collapse

Interface Summary collapse

Function Summary collapse

Type Details

DecoderOptions struct

DecoderOptions is the Decoder configuration options.

Structure Fields:

Logger logging.Logger
LogMessages bool

EncoderOptions struct

EncoderOptions is the configuration options for Encoder.

Structure Fields:

Logger logging.Logger
LogMessages bool

Header struct

Header is a single EventStream Key Value header pair.

Structure Fields:

Name string
Value Value

Function Details

func EncodeHeaders(w io.Writer, headers Headers) error

EncodeHeaders writes the header values to the writer encoded in the event stream format. Returns an error if a header fails to encode.



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// File 'aws/protocol/eventstream/encode.go', line 141

func EncodeHeaders(w io.Writer, headers Headers) error { for _, h := range headers { hn := headerName{ Len: uint8(len(h.Name)), } copy(hn.Name[:hn.Len], h.Name) if err := hn.encode(w); err != nil { return err } if err := h.Value.encode(w); err != nil { return err } } return nil }

func NewDecoder(optFns ...func(*DecoderOptions)) *Decoder

NewDecoder initializes and returns a Decoder for decoding event stream messages from the reader provided.



27
28
29
30
31
32
33
34
35
36
37
// File 'aws/protocol/eventstream/decode.go', line 27

func NewDecoder(optFns ...func(*DecoderOptions)) *Decoder { options := DecoderOptions{} for _, fn := range optFns { fn(&options) } return &Decoder{ options: options, } }

func NewEncoder(optFns ...func(*EncoderOptions)) *Encoder

NewEncoder initializes and returns an Encoder to encode Event Stream messages.



30
31
32
33
34
35
36
37
38
39
40
41
42
// File 'aws/protocol/eventstream/encode.go', line 30

func NewEncoder(optFns ...func(*EncoderOptions)) *Encoder { o := EncoderOptions{} for _, fn := range optFns { fn(&o) } return &Encoder{ options: o, headersBuf: bytes.NewBuffer(nil), messageBuf: bytes.NewBuffer(nil), } }