Filo.Protobuf (Filo v0.2.0)

Copy Markdown View Source

Protobuf codec for the Hrana 3 shared structures.

Filo's execution core works on the canonical Hrana JSON-term maps (the same maps Jason produces/consumes — integers carried as strings, blobs as no-pad base64, values tagged by "type"). Protobuf is therefore a pure edge codec: these functions convert between protobuf wire bytes and those same maps, so the streams/dispatch/execution layers never change. The HTTP and WebSocket message envelopes are layered on top in Filo.Protobuf.Http and Filo.Protobuf.Ws.

Each encode_*/1 returns the message body as iodata/0 (a container embeds it with Filo.Protobuf.Wire.field_len/2); each decode_*/1 takes the message bytes and returns the Hrana map. Field numbers follow the proto3 schema in the Hrana 3 spec.

Summary

Functions

decode_batch(bin)

@spec decode_batch(binary()) :: map()

decode_batch_result(bin)

@spec decode_batch_result(binary()) :: map()

decode_cond(bin)

@spec decode_cond(binary()) :: map()

Decodes a BatchCond message into a Hrana condition map.

decode_cursor_entry(bin)

@spec decode_cursor_entry(binary()) :: map()

decode_describe_result(bin)

@spec decode_describe_result(binary()) :: map()

decode_error(bin)

@spec decode_error(binary()) :: map()

decode_stmt(bin)

@spec decode_stmt(binary()) :: map()

decode_stmt_result(bin)

@spec decode_stmt_result(binary()) :: map()

decode_value(bin)

@spec decode_value(binary()) :: map()

Decodes a Value message into a Hrana value map.

encode_batch(batch)

@spec encode_batch(map()) :: iodata()

encode_batch_result(result)

@spec encode_batch_result(map()) :: iodata()

encode_cond(map)

@spec encode_cond(map()) :: iodata()

Encodes a Hrana BatchCond map into a BatchCond message body.

encode_cursor_entry(e)

@spec encode_cursor_entry(map()) :: iodata()

encode_describe_result(describe)

@spec encode_describe_result(map()) :: iodata()

encode_error(error)

@spec encode_error(map()) :: iodata()

encode_stmt(stmt)

@spec encode_stmt(map()) :: iodata()

encode_stmt_result(result)

@spec encode_stmt_result(map()) :: iodata()

encode_value(map)

@spec encode_value(map()) :: iodata()

Encodes a Hrana value map into a Value message body.