QuackDB.Protocol.Codec (quackdb v0.1.0)

Copy Markdown View Source

Encoder and decoder for top-level Quack protocol messages.

This module converts between message structs and wire-format binaries. It is kept independent from HTTP, DBConnection, and public client APIs so protocol compatibility can be tested in isolation.

Summary

Types

decoded_message()

@type decoded_message() :: {QuackDB.Protocol.Message.Header.t(), struct()}

Functions

decode(binary)

@spec decode(binary()) :: {:ok, decoded_message()} | {:error, QuackDB.Error.t()}

decode_header(binary)

encode(message, options \\ [])

@spec encode(
  struct(),
  Keyword.t()
) :: iodata()

encode_header(header)

@spec encode_header(QuackDB.Protocol.Message.Header.t()) :: iodata()