Skip to content

Commit 016c440

Browse files
Merge pull request #13700 from rabbitmq/mergify/bp/v4.0.x/pr-13699
Fix type spec for AMQP 1.0 address (backport #13696) (backport #13699)
2 parents d706ddb + c6b510f commit 016c440

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

deps/amqp10_client/src/amqp10_client.erl

+7-5
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
-type terminus_durability() :: amqp10_client_session:terminus_durability().
4949

50+
-type terminus_address() :: amqp10_client_session:terminus_address().
5051
-type target_def() :: amqp10_client_session:target_def().
5152
-type source_def() :: amqp10_client_session:source_def().
5253

@@ -64,6 +65,7 @@
6465
snd_settle_mode/0,
6566
rcv_settle_mode/0,
6667
terminus_durability/0,
68+
terminus_address/0,
6769
target_def/0,
6870
source_def/0,
6971
attach_role/0,
@@ -168,7 +170,7 @@ attach_sender_link_sync(Session, Name, Target) ->
168170
%% @doc Synchronously attach a link on 'Session'.
169171
%% This is a convenience function that awaits attached event
170172
%% for the link before returning.
171-
-spec attach_sender_link_sync(pid(), binary(), binary(),
173+
-spec attach_sender_link_sync(pid(), binary(), terminus_address(),
172174
snd_settle_mode()) ->
173175
{ok, link_ref()} | link_timeout.
174176
attach_sender_link_sync(Session, Name, Target, SettleMode) ->
@@ -177,7 +179,7 @@ attach_sender_link_sync(Session, Name, Target, SettleMode) ->
177179
%% @doc Synchronously attach a link on 'Session'.
178180
%% This is a convenience function that awaits attached event
179181
%% for the link before returning.
180-
-spec attach_sender_link_sync(pid(), binary(), binary(),
182+
-spec attach_sender_link_sync(pid(), binary(), terminus_address(),
181183
snd_settle_mode(), terminus_durability()) ->
182184
{ok, link_ref()} | link_timeout.
183185
attach_sender_link_sync(Session, Name, Target, SettleMode, Durability) ->
@@ -195,7 +197,7 @@ attach_sender_link_sync(Session, Name, Target, SettleMode, Durability) ->
195197
%% This is asynchronous and will notify completion of the attach request to the
196198
%% caller using an amqp10_event of the following format:
197199
%% {amqp10_event, {link, LinkRef, attached | {detached, Why}}}
198-
-spec attach_sender_link(pid(), binary(), binary()) -> {ok, link_ref()}.
200+
-spec attach_sender_link(pid(), binary(), terminus_address()) -> {ok, link_ref()}.
199201
attach_sender_link(Session, Name, Target) ->
200202
% mixed should work with any type of msg
201203
attach_sender_link(Session, Name, Target, mixed).
@@ -204,7 +206,7 @@ attach_sender_link(Session, Name, Target) ->
204206
%% This is asynchronous and will notify completion of the attach request to the
205207
%% caller using an amqp10_event of the following format:
206208
%% {amqp10_event, {link, LinkRef, attached | {detached, Why}}}
207-
-spec attach_sender_link(pid(), binary(), binary(),
209+
-spec attach_sender_link(pid(), binary(), terminus_address(),
208210
snd_settle_mode()) ->
209211
{ok, link_ref()}.
210212
attach_sender_link(Session, Name, Target, SettleMode) ->
@@ -214,7 +216,7 @@ attach_sender_link(Session, Name, Target, SettleMode) ->
214216
%% This is asynchronous and will notify completion of the attach request to the
215217
%% caller using an amqp10_event of the following format:
216218
%% {amqp10_event, {link, LinkRef, attached | {detached, Why}}}
217-
-spec attach_sender_link(pid(), binary(), binary(),
219+
-spec attach_sender_link(pid(), binary(), terminus_address(),
218220
snd_settle_mode(), terminus_durability()) ->
219221
{ok, link_ref()}.
220222
attach_sender_link(Session, Name, Target, SettleMode, Durability) ->

deps/amqp10_client/src/amqp10_client_session.erl

+8-4
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,22 @@
6565
-define(INITIAL_DELIVERY_COUNT, ?UINT_MAX - 2).
6666

6767
-type link_name() :: binary().
68-
-type link_address() :: binary().
68+
%% https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-address-string
69+
%% or
70+
%% https://docs.oasis-open.org/amqp/anonterm/v1.0/anonterm-v1.0.html
71+
-type terminus_address() :: binary() | null.
6972
-type link_role() :: sender | receiver.
70-
-type link_target() :: {pid, pid()} | binary() | undefined.
73+
-type link_target() :: {pid, pid()} | terminus_address() | undefined.
7174
%% "The locally chosen handle is referred to as the output handle." [2.6.2]
7275
-type output_handle() :: link_handle().
7376
%% "The remotely chosen handle is referred to as the input handle." [2.6.2]
7477
-type input_handle() :: link_handle().
7578

7679
-type terminus_durability() :: none | configuration | unsettled_state.
7780

78-
-type target_def() :: #{address => link_address(),
81+
-type target_def() :: #{address => terminus_address(),
7982
durable => terminus_durability()}.
80-
-type source_def() :: #{address => link_address(),
83+
-type source_def() :: #{address => terminus_address(),
8184
durable => terminus_durability()}.
8285

8386
-type attach_role() :: {sender, target_def()} | {receiver, source_def(), pid()}.
@@ -112,6 +115,7 @@
112115
terminus_durability/0,
113116
attach_args/0,
114117
attach_role/0,
118+
terminus_address/0,
115119
target_def/0,
116120
source_def/0,
117121
filter/0,

0 commit comments

Comments
 (0)