%% Signature specifications for protocol implementations.
--ifndef(THRIFT_PROTOCOL_IMPL_INCLUDED).
--define(THRIFT_PROTOCOL_IMPL_INCLUDED, true).
+-ifndef(THRIFT_PROTOCOL_BEHAVIOUR_INCLUDED).
+-define(THRIFT_PROTOCOL_BEHAVIOUR_INCLUDED, true).
-spec flush_transport(state()) -> {state(), ok | {error, _Reason}}.
-spec close_transport(state()) -> {state(), ok | {error, _Reason}}.
%% Signature specifications for transport implementations.
--ifndef(THRIFT_TRANSPORT_IMPL_INCLUDED).
--define(THRIFT_TRANSPORT_IMPL_INCLUDED, true).
+-ifndef(THRIFT_TRANSPORT_BEHAVIOUR_INCLUDED).
+-define(THRIFT_TRANSPORT_BEHAVIOUR_INCLUDED, true).
-spec write(state(), iolist() | binary()) -> {state(), ok | {error, _Reason}}.
-spec read(state(), non_neg_integer()) -> {state(), {ok, binary()} | {error, _Reason}}.
%% State
-record(b64_transport, {wrapped}).
-type state() :: #b64_transport{}.
--include("thrift_transport_impl.hrl").
+-include("thrift_transport_behaviour.hrl").
new(Wrapped) ->
State = #b64_transport{wrapped = Wrapped},
strict_write=true
}).
-type state() :: #binary_protocol{}.
--include("thrift_protocol_impl.hrl").
+-include("thrift_protocol_behaviour.hrl").
-define(VERSION_MASK, 16#FFFF0000).
-define(VERSION_1, 16#80010000).
write_buffer % iolist()
}).
-type state() :: #buffered_transport{}.
--include("thrift_transport_impl.hrl").
+-include("thrift_transport_behaviour.hrl").
new(WrappedTransport) ->
sync_every = infinity,
sync_tref}).
-type state() :: #dl_transport{}.
--include("thrift_transport_impl.hrl").
+-include("thrift_transport_behaviour.hrl").
%% Create a transport attached to an already open log.
should_close = true,
mode = write}).
-type state() :: #t_file_transport{}.
--include("thrift_transport_impl.hrl").
+-include("thrift_transport_behaviour.hrl").
%%%% CONSTRUCTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
write_buffer % iolist()
}).
-type state() :: #framed_transport{}.
--include("thrift_transport_impl.hrl").
+-include("thrift_transport_behaviour.hrl").
new(WrappedTransport) ->
State = #framed_transport{wrapped = WrappedTransport,
extra_headers % [{str(), str()}, ...]
}).
-type state() :: pid().
--include("thrift_transport_impl.hrl").
+-include("thrift_transport_behaviour.hrl").
new(Host, Path) ->
new(Host, Path, _Options = []).
-record(memory_buffer, {buffer}).
-type state() :: #memory_buffer{}.
--include("thrift_transport_impl.hrl").
+-include("thrift_transport_behaviour.hrl").
new() ->
State = #memory_buffer{buffer = []},
{IProto2, {ok, RTuple2}}.
-%% NOTE: Keep this in sync with thrift_protocol_impl:read
+%% NOTE: Keep this in sync with thrift_protocol_behaviour:read
-spec read
(#protocol{}, {struct, _Info}) -> {#protocol{}, {ok, tuple()} | {error, _Reason}};
(#protocol{}, tprot_cont_tag()) -> {#protocol{}, {ok, term()} | {error, _Reason}};
read(Protocol, ProtocolType) ->
read_specific(Protocol, ProtocolType).
-%% NOTE: Keep this in sync with thrift_protocol_impl:read
+%% NOTE: Keep this in sync with thrift_protocol_behaviour:read
-spec read_specific
(#protocol{}, tprot_empty_tag()) -> {#protocol{}, ok | {error, _Reason}};
(#protocol{}, tprot_header_tag()) -> {#protocol{}, tprot_header_val() | {error, _Reason}};
-record(data, {socket,
recv_timeout=infinity}).
-type state() :: #data{}.
--include("thrift_transport_impl.hrl").
+-include("thrift_transport_behaviour.hrl").
new(Socket) ->
new(Socket, []).
counter :: pid()
}).
-type state() :: #trans{}.
--include("thrift_transport_impl.hrl").
+-include("thrift_transport_behaviour.hrl").
-record(state, {cversion :: integer()}).