File: mc.hrl

package info (click to toggle)
rabbitmq-server 4.0.5-9
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 38,056 kB
  • sloc: erlang: 257,826; javascript: 22,466; sh: 3,037; makefile: 2,517; python: 1,966; xml: 646; cs: 335; java: 244; ruby: 212; php: 100; perl: 63; awk: 13
file content (36 lines) | stat: -rw-r--r-- 1,761 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
%% good enough for most use cases
-define(IS_MC(Msg), element(1, Msg) == mc andalso tuple_size(Msg) == 5).

%% "Short strings can carry up to 255 octets of UTF-8 data, but
%% may not contain binary zero octets." [AMQP 0.9.1 $4.2.5.3]
-define(IS_SHORTSTR_LEN(B), byte_size(B) < 256).

%% We keep the following atom annotation keys short as they are stored per message on disk.
-define(ANN_EXCHANGE, x).
-define(ANN_ROUTING_KEYS, rk).
-define(ANN_TIMESTAMP, ts).
-define(ANN_RECEIVED_AT_TIMESTAMP, rts).
-define(ANN_DURABLE, d).
-define(ANN_PRIORITY, p).

-define(FF_MC_DEATHS_V2, message_containers_deaths_v2).

-type death_key() :: {SourceQueue :: rabbit_misc:resource_name(), rabbit_dead_letter:reason()}.
-type death_anns() :: #{%% timestamp of the first time this message
                        %% was dead lettered from this queue for this reason
                        first_time := pos_integer(),
                        %% timestamp of the last time this message
                        %% was dead lettered from this queue for this reason
                        last_time := pos_integer(),
                        ttl => OriginalTtlHeader :: non_neg_integer()}.

-record(death, {exchange :: OriginalExchange :: rabbit_misc:resource_name(),
                routing_keys :: OriginalRoutingKeys :: [rabbit_types:routing_key(),...],
                %% how many times this message was dead lettered from this queue for this reason
                count :: pos_integer(),
                anns :: death_anns()}).

-record(deaths, {first :: death_key(), % redundant to mc annotations x-first-death-*
                 last :: death_key(), % redundant to mc annotations x-last-death-*
                 records :: #{death_key() := #death{}}
                }).