rabbitmq-server/deps/rabbit/include/amqqueue_v2.hrl

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
1.2 KiB
Erlang
Raw Permalink Normal View History

Make #amqqueue{} a private record + add a feature flag The #amqqueue{} record is now isolated in the `amqqueue` module: all accesses and modifications to the record are made through this helper. The type `rabbit_types:amqqueue()` is now `amqqueue:amqqueue()`. `amqqueue` knows about the new #amqqueue{} record introduced with quorum queues. If the actual record is the old one (as defined in RabbitMQ 3.7.x), it calls `amqqueue_v1` which knows about the old definition. When it needs to produce an #amqqueue{} record, it verifies if it is allowed to, using the new Feature flags subsystem and the `quorum_queue` feature flag specifically, and proceeds. If an old format #amqqueue{} is required, the creation is deferred to `amqqueue_v1`. The new modules come with a couple headers: they provide macros to replace pattern matching with `when` conditions. The `amqqueue_v*.hrl` headers are generated using the `macros()` functions in `amqqueue` and `amqqueue_v1` modules. Some operations now depend on the state of the `quorum_queue` feature flag. In particular, creating a quorum queue is denied if the feature flag is disabled. In the process, the following modules were moved from rabbitmq-common to rabbitmq-server: * rabbit_backing_queue * rabbit_queue_master_locator Likewise, the few functions were copied from `rabbit_misc` to `rabbit_amqqueue` because they depend on `amqqueue`. They don't really need to live in rabbitmq-common and they prevent further progress with the feature flags: feature flags need informations about the cluster. The `quorum_queue` feature flag comes with a migration function which is responsible of converting the #amqqueue{} records in Mnesia tables `rabbit_queue` and `rabbit_durable_queue`. Therefore, the upgrade function which did this is removed in this commit. [#159298729]
2018-10-11 18:12:39 +08:00
-define(is_amqqueue_v2(Q), is_record(Q, amqqueue, 21)).
-define(amqqueue_v2_field_name(Q), element(2, Q)).
-define(amqqueue_v2_field_durable(Q), element(3, Q)).
-define(amqqueue_v2_field_auto_delete(Q), element(4, Q)).
-define(amqqueue_v2_field_exclusive_owner(Q), element(5, Q)).
-define(amqqueue_v2_field_arguments(Q), element(6, Q)).
-define(amqqueue_v2_field_pid(Q), element(7, Q)).
-define(amqqueue_v2_field_slave_pids(Q), element(8, Q)).
-define(amqqueue_v2_field_sync_slave_pids(Q), element(9, Q)).
-define(amqqueue_v2_field_recoverable_slaves(Q), element(10, Q)).
-define(amqqueue_v2_field_policy(Q), element(11, Q)).
-define(amqqueue_v2_field_operator_policy(Q), element(12, Q)).
-define(amqqueue_v2_field_gm_pids(Q), element(13, Q)).
-define(amqqueue_v2_field_decorators(Q), element(14, Q)).
-define(amqqueue_v2_field_state(Q), element(15, Q)).
-define(amqqueue_v2_field_policy_version(Q), element(16, Q)).
-define(amqqueue_v2_field_slave_pids_pending_shutdown(Q), element(17, Q)).
-define(amqqueue_v2_field_vhost(Q), element(18, Q)).
-define(amqqueue_v2_field_options(Q), element(19, Q)).
-define(amqqueue_v2_field_type(Q), element(20, Q)).
-define(amqqueue_v2_field_type_state(Q), element(21, Q)).