Low-level Thrift binary protocol request/response over a framed socket.
This module encodes Thrift CALL messages and decodes REPLY messages
using the binary protocol. It is intentionally ignorant of business logic —
NebulaGraphEx.Thrift.GraphService builds on this to provide typed calls.
Thrift binary message layout (inside the frame)
<< 0x80, 0x01, :: 2 bytes — version + message type (CALL = 1)
0x00, 0x00, :: 2 bytes — unused (version high bits)
name_len::32-big, :: 4 bytes — method name length
name::binary, :: N bytes — method name
seq_id::32-big, :: 4 bytes — sequence number
...struct fields :: variable — Thrift struct encoding
0x00 >> :: 1 byte — STOP fieldReplies mirror this layout but with message type REPLY (2) or
EXCEPTION (3).
Summary
Functions
Encodes a length-prefixed binary / string.
Encodes a bool.
Encodes a byte.
Encodes and sends a Thrift CALL message, then receives and decodes the
REPLY.
Sends a one-way Thrift CALL (no reply expected, e.g. signout).
Decodes a bool.
Decodes a byte.
Decodes a double.
Decodes an i16.
Decodes an i32.
Decodes an i64.
Decodes a length-prefixed binary/string.
Encodes a double.
Encodes a Thrift binary message header + body.
Encodes a field header (type byte + field id).
Encodes an i16.
Encodes an i32.
Encodes an i64.
Encodes a list field (etype, count, then elements).
Encodes a map field (ktype, vtype, count, then pairs).
Skips field headers and returns {field_id, type, rest}.
Encodes the STOP byte that terminates a struct.
Functions
Encodes a length-prefixed binary / string.
Encodes a bool.
Encodes a byte.
@spec call(NebulaGraphEx.Transport.socket(), binary(), iodata(), integer(), timeout()) :: {:ok, binary()} | {:error, term()}
Encodes and sends a Thrift CALL message, then receives and decodes the
REPLY.
socket— a socket returned byNebulaGraphEx.Transport.connect/3method— binary method name, e.g."execute"args_iodata— already-encoded struct fields (fromencode_struct/1)seq_id— sequence number (any integer; 1 is fine for sequential use)recv_timeout— milliseconds to wait for the reply frame
Returns {:ok, reply_payload} where reply_payload is the raw bytes of
the reply message body (after the message header), or {:error, reason}.
@spec cast(NebulaGraphEx.Transport.socket(), binary(), iodata(), integer()) :: :ok | {:error, term()}
Sends a one-way Thrift CALL (no reply expected, e.g. signout).
Decodes a bool.
Decodes a byte.
Decodes a double.
Decodes an i16.
Decodes an i32.
Decodes an i64.
Decodes a length-prefixed binary/string.
Encodes a double.
Encodes a Thrift binary message header + body.
Encodes a field header (type byte + field id).
Encodes an i16.
Encodes an i32.
Encodes an i64.
Encodes a list field (etype, count, then elements).
Encodes a map field (ktype, vtype, count, then pairs).
Skips field headers and returns {field_id, type, rest}.
Encodes the STOP byte that terminates a struct.