Packages
kafka_protocol
2.3.2
4.3.4
4.3.3
4.3.2
4.3.1
4.3.0
4.2.9
4.2.8
4.2.7
4.2.6
4.2.5
4.2.4
4.2.3
4.2.2
4.2.1
4.2.0
4.1.10
4.1.9
4.1.8
4.1.7
4.1.6
4.1.5
4.1.4
4.1.3
4.1.2
4.1.1
4.1.0
4.0.3
4.0.2
4.0.1
3.0.1
3.0.0
2.4.1
2.3.6
2.3.5
2.3.4
2.3.3
2.3.2
2.3.1
2.3.0
2.2.9
2.2.8
2.2.7
2.2.6
2.2.5
2.2.4
2.2.3
2.2.2
2.2.1
2.2.0
2.1.2
2.1.1
2.1.0
2.0.1
2.0.0
1.1.3
1.1.2
1.1.1
1.1.0
1.0.0
0.9.2
0.9.1
0.9.0
0.8.0
0.7.8
0.7.7
0.7.6
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.0
0.4.0
0.3.2
0.3.1
0.2.3
Kafka protocol library for Erlang/Elixir
Current section
Files
Jump to
Current section
Files
include/kpro_private.hrl
%%% Copyright (c) 2014-2017, Klarna AB
%%%
%%% Licensed under the Apache License, Version 2.0 (the "License");
%%% you may not use this file except in compliance with the License.
%%% You may obtain a copy of the License at
%%%
%%% http://www.apache.org/licenses/LICENSE-2.0
%%%
%%% Unless required by applicable law or agreed to in writing, software
%%% distributed under the License is distributed on an "AS IS" BASIS,
%%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%%% See the License for the specific language governing permissions and
%%% limitations under the License.
%%%
%% Internal use only
-ifndef(KPRO_PRIVATE_HRL).
-define(KPRO_PRIVATE_HRL, true).
-include("kpro.hrl").
-define(no_compression, no_compression).
-define(gzip, gzip).
-define(snappy, snappy).
-define(lz4, lz4).
%% Compression attributes
-define(KPRO_COMPRESS_NONE, 0).
-define(KPRO_COMPRESS_GZIP, 1).
-define(KPRO_COMPRESS_SNAPPY, 2).
-define(KPRO_COMPRESS_LZ4, 3).
-define(KPRO_COMPRESSION_MASK, 2#111).
-define(KPRO_IS_GZIP_ATTR(ATTR),
((?KPRO_COMPRESSION_MASK band ATTR) =:= ?KPRO_COMPRESS_GZIP)).
-define(KPRO_IS_SNAPPY_ATTR(ATTR),
((?KPRO_COMPRESSION_MASK band ATTR) =:= ?KPRO_COMPRESS_SNAPPY)).
-define(KPRO_IS_LZ4_ATTR(ATTR),
((?KPRO_COMPRESSION_MASK band ATTR) =:= ?KPRO_COMPRESS_LZ4)).
-define(KPRO_TS_TYPE_CREATE, 0).
-define(KPRO_TS_TYPE_APPEND, 2#1000).
-define(KPRO_TS_TYPE_MASK, 2#1000).
-define(KPRO_IS_CREATE_TS(ATTR), ((?KPRO_TS_TYPE_MASK band ATTR) =:= 0)).
-define(KPRO_IS_APPEND_TS(ATTR), ((?KPRO_TS_TYPE_MASK band ATTR) =/= 0)).
%% some pre-defined default values
-define(KPRO_REPLICA_ID, -1).
-define(KPRO_API_VERSION, 0).
-define(KPRO_MAGIC_0, 0).
-define(KPRO_MAGIC_1, 1).
-define(IS_KAFKA_PRIMITIVE(T),
(T =:= boolean orelse T =:= int8 orelse T =:= int16 orelse
T =:= int32 orelse T =:= int64 orelse
T =:= string orelse T =:= nullable_string orelse
T =:= bytes orelse T =:= records)).
-define(null, ?kpro_null).
-define(INT, signed-integer).
-define(ISOLATION_LEVEL_ATOM(I),
case I of
0 -> ?kpro_read_uncommitted;
1 -> ?kpro_read_committed
end).
-define(ISOLATION_LEVEL_INTEGER(I),
case I of
?kpro_read_uncommitted -> 0;
?kpro_read_committed -> 1
end).
-define(SCHEMA_MODULE, kpro_schema).
-define(IS_STRUCT(S), (is_list(S) orelse is_map(S))).
-define(MIN_MAGIC_2_PRODUCE_API_VSN, 3). %% since kafka 0.11
-define(MIN_MAGIC_2_FETCH_API_VSN, 4). %% since kafka 0.11
-define(MIN_INCREMENTAL_FETCH_API_VSN, 7). %% since kafka 1.1.0
%% SASL auth mechanisms
-define(plain, plain).
-define(scram_sha_256, scram_sha_256).
-define(scram_sha_512, scram_sha_512).
-define(IS_SCRAM(Mechanism), (Mechanism =:= ?scram_sha_256 orelse
Mechanism =:= ?scram_sha_512)).
-define(IS_PLAIN_OR_SCRAM(Mechanism), (Mechanism =:= ?plain orelse
?IS_SCRAM(Mechanism))).
-define(KAFKA_0_9, 9).
-define(KAFKA_0_10, 10).
-define(KAFKA_0_11, 11).
-define(KAFKA_1_0, 100).
-define(KAFKA_1_1, 110).
-ifdef(OTP_RELEASE).
-define(BIND_STACKTRACE(Var), :Var).
-define(GET_STACKTRACE(Var), ok).
-else.
-define(BIND_STACKTRACE(Var),).
-define(GET_STACKTRACE(Var), Var = erlang:get_stacktrace()).
-endif.
-ifndef(OLD_TIME_UNITS).
-define(millisecond, millisecond).
-else.
-define(millisecond, milli_seconds).
-endif.
-endif.
%%%_* Emacs ====================================================================
%%% Local Variables:
%%% allout-layout: t
%%% erlang-indent-level: 2
%%% End: