summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-05-18 10:50:17 +0100
committerSimon MacMullen <simon@rabbitmq.com>2012-05-18 10:50:17 +0100
commit119fdcd4ce38fec31d6e2f50d349458d876a3392 (patch)
tree94717f64f7d4d5d1cb33835d8df392f3529f5ca2
parent25484ae2e09a4ad29520b8e7bed6f55c2e3d595d (diff)
downloadrabbitmq-server-git-119fdcd4ce38fec31d6e2f50d349458d876a3392.tar.gz
TODO--: Update behaviour
-rw-r--r--src/rabbit_exchange_decorator.erl60
1 files changed, 38 insertions, 22 deletions
diff --git a/src/rabbit_exchange_decorator.erl b/src/rabbit_exchange_decorator.erl
index 9f30688df9..b8583c822c 100644
--- a/src/rabbit_exchange_decorator.erl
+++ b/src/rabbit_exchange_decorator.erl
@@ -16,36 +16,52 @@
-module(rabbit_exchange_decorator).
--export([behaviour_info/1]).
+-ifdef(use_specs).
-%% TODO make this into a modern typed callback
+-type(tx() :: 'transaction' | 'none').
+-type(serial() :: pos_integer() | tx()).
-behaviour_info(callbacks) ->
- [
- {description, 0},
+-callback description() -> [proplist:property()].
+
+%% Should Rabbit ensure that all binding events that are
+%% delivered to an individual exchange can be serialised? (they
+%% might still be delivered out of order, but there'll be a
+%% serial number).
+-callback serialise_events(rabbit_types:exchange()) -> boolean().
+
+%% The no_return is there so that we can have an "invalid" exchange
+%% type (see rabbit_exchange_type_invalid).
+-callback route(rabbit_types:exchange(), rabbit_types:delivery()) ->
+ rabbit_router:match_result().
- %% Should Rabbit ensure that all binding events that are
- %% delivered to an individual exchange can be serialised? (they
- %% might still be delivered out of order, but there'll be a
- %% serial number).
- {serialise_events, 1},
+%% called after declaration and recovery
+-callback create(tx(), rabbit_types:exchange()) -> 'ok'.
- {route, 2},
+%% called after exchange (auto)deletion.
+-callback delete(tx(), rabbit_types:exchange(), [rabbit_types:binding()]) ->
+ 'ok'.
- %% called after declaration and recovery
- {create, 2},
+%% called after a binding has been added or recovered
+-callback add_binding(serial(), rabbit_types:exchange(),
+ rabbit_types:binding()) -> 'ok'.
- %% called after exchange (auto)deletion.
- {delete, 3},
+%% called after bindings have been deleted.
+-callback remove_bindings(serial(), rabbit_types:exchange(),
+ [rabbit_types:binding()]) -> 'ok'.
- %% called after a binding has been added or recovered
- {add_binding, 3},
+%% called when the policy attached to this exchange changes.
+-callback policy_changed (
+ serial(), rabbit_types:exchange(), rabbit_types:exchange()) -> 'ok'.
- %% called after bindings have been deleted.
- {remove_bindings, 3},
+-else.
- %% called when the policy attached to this exchange changes.
- {policy_changed, 3}
- ];
+-export([behaviour_info/1]).
+
+behaviour_info(callbacks) ->
+ [{description, 0}, {serialise_events, 1}, {route, 2},
+ {create, 2}, {delete, 3}, {add_binding, 3}, {remove_bindings, 3},
+ {policy_changed, 3}];
behaviour_info(_Other) ->
undefined.
+
+-endif.