View Source Bella.Watcher.ResponseBuffer (bella v0.2.2)

Buffers streaming responses from HTTPoison and returns kubernetes watch events as JSON

ResponseBuffer implementation from Kazan's LineBuffer.

Link to this section Summary

Functions

Add an HTTP response chunk to the buffer

Returns complete lines of JSON from streaming HTTP Response.

Create a new ResponseBuffer

Link to this section Types

Specs

t() :: %Bella.Watcher.ResponseBuffer{lines: [binary()], pending: binary()}

Link to this section Functions

Link to this function

add_chunk(response_buffer, chunk)

View Source

Specs

add_chunk(t(), binary()) :: t()

Add an HTTP response chunk to the buffer

Specs

get_lines(t()) :: {[binary()], t()}

Returns complete lines of JSON from streaming HTTP Response.

Lines are in NDJSON format; each line is a JSON object.

Specs

new() :: t()

Create a new ResponseBuffer