File: rabbit_khepri.hrl

package info (click to toggle)
rabbitmq-server 4.0.5-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • 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 (64 lines) | stat: -rw-r--r-- 2,924 bytes parent folder | download | duplicates (3)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
%% This Source Code Form is subject to the terms of the Mozilla Public
%% License, v. 2.0. If a copy of the MPL was not distributed with this
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2024 Broadcom. All Rights Reserved. The term “Broadcom”
%% refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
%%

%% This header has macros that define the `khepri_path:native_pattern()'
%% path patterns used for each piece of metadata in the store. We use macros
%% for these so that we can pattern match on these path patterns as well as
%% create them as new terms.
%%
%% If you are creating a path pattern to use in a call to the Khepri API (for
%% example `rabbit_khepri:get/1') you should prefer using the
%% `khepri_<entity>_path' function from the `rabbit_db_<entity>' modules
%% instead, for example `rabbit_db_queue:khepri_queue_path/2', since those
%% functions have guards to assert that the variables passed are valid pattern
%% components.

-define(RABBITMQ_KHEPRI_ROOT_PATH, ?RABBITMQ_KHEPRI_ROOT_PATH([])).
-define(RABBITMQ_KHEPRI_ROOT_PATH(Rest), [rabbitmq | Rest]).

-define(RABBITMQ_KHEPRI_MAINTENANCE_PATH(Node),
        ?RABBITMQ_KHEPRI_ROOT_PATH([node_maintenance, Node])).

-define(RABBITMQ_KHEPRI_GLOBAL_RUNTIME_PARAM_PATH(Key),
        ?RABBITMQ_KHEPRI_ROOT_PATH([runtime_params, Key])).

-define(RABBITMQ_KHEPRI_USER_PATH(Username),
        ?RABBITMQ_KHEPRI_ROOT_PATH([users, Username])).

-define(RABBITMQ_KHEPRI_MIRRORED_SUPERVISOR_PATH(Group, Id),
        ?RABBITMQ_KHEPRI_ROOT_PATH([mirrored_supervisors, Group, Id])).

-define(RABBITMQ_KHEPRI_VHOST_PATH(Name),
        ?RABBITMQ_KHEPRI_VHOST_PATH(Name, [])).
-define(RABBITMQ_KHEPRI_VHOST_PATH(Name, Rest),
        ?RABBITMQ_KHEPRI_ROOT_PATH([vhosts, Name | Rest])).

-define(RABBITMQ_KHEPRI_VHOST_RUNTIME_PARAM_PATH(VHost, Component, Name),
        ?RABBITMQ_KHEPRI_VHOST_PATH(VHost, [runtime_params, Component, Name])).

-define(RABBITMQ_KHEPRI_USER_PERMISSION_PATH(VHost, Username),
        ?RABBITMQ_KHEPRI_VHOST_PATH(VHost, [user_permissions, Username])).

-define(RABBITMQ_KHEPRI_EXCHANGE_PATH(VHost, Name),
        ?RABBITMQ_KHEPRI_EXCHANGE_PATH(VHost, Name, [])).
-define(RABBITMQ_KHEPRI_EXCHANGE_PATH(VHost, Name, Rest),
        ?RABBITMQ_KHEPRI_VHOST_PATH(VHost, [exchanges, Name | Rest])).

-define(RABBITMQ_KHEPRI_EXCHANGE_SERIAL_PATH(VHost, Name),
        ?RABBITMQ_KHEPRI_EXCHANGE_PATH(VHost, Name, [serial])).

-define(RABBITMQ_KHEPRI_TOPIC_PERMISSION_PATH(VHost, Exchange, Username),
        ?RABBITMQ_KHEPRI_EXCHANGE_PATH(
          VHost, Exchange, [user_permissions, Username])).

-define(RABBITMQ_KHEPRI_ROUTE_PATH(VHost, SrcName, Kind, DstName, RoutingKey),
        ?RABBITMQ_KHEPRI_EXCHANGE_PATH(
          VHost, SrcName, [bindings, Kind, DstName, RoutingKey])).

-define(RABBITMQ_KHEPRI_QUEUE_PATH(VHost, Name),
        ?RABBITMQ_KHEPRI_VHOST_PATH(VHost, [queues, Name])).