@@ -17,7 +17,7 @@ pub trait NamedCommandMessage {
17
17
}
18
18
19
19
pub trait CommandMessageHeaderEq {
20
- fn header_eq ( & self , other : & Self ) -> bool ;
20
+ fn header_eq ( & self , other : & Self , ignore_payload_equality : bool ) -> bool ;
21
21
}
22
22
23
23
pub trait CommandMessageHeaderDiff {
@@ -36,6 +36,10 @@ macro_rules! impl_message_traits {
36
36
( $name: ident: command) => {
37
37
impl_message_traits!( $name: message) ;
38
38
impl_message_traits!( $name: named_command) ;
39
+ } ;
40
+ ( $name: ident: command eq) => {
41
+ impl_message_traits!( $name: message) ;
42
+ impl_message_traits!( $name: named_command) ;
39
43
impl_message_traits!( $name: command_header_eq) ;
40
44
} ;
41
45
( $name: ident: message) => {
@@ -54,7 +58,7 @@ macro_rules! impl_message_traits {
54
58
} ;
55
59
( $name: ident: command_header_eq) => {
56
60
impl CommandMessageHeaderEq for paste! { [ <$name Message >] } {
57
- fn header_eq( & self , other: & Self ) -> bool {
61
+ fn header_eq( & self , other: & Self , _ : bool ) -> bool {
58
62
self . eq( other)
59
63
}
60
64
}
@@ -69,53 +73,140 @@ impl_message_traits!(End: core);
69
73
impl_message_traits ! ( ProposeRunCompletion : core) ;
70
74
71
75
// -- Entries
72
- impl_message_traits ! ( InputCommand : message) ;
73
- impl_message_traits ! ( InputCommand : named_command) ;
76
+ impl_message_traits ! ( InputCommand : command) ;
74
77
impl CommandMessageHeaderEq for InputCommandMessage {
75
- fn header_eq ( & self , _: & Self ) -> bool {
78
+ fn header_eq ( & self , _: & Self , _ : bool ) -> bool {
76
79
true
77
80
}
78
81
}
79
82
80
83
impl_message_traits ! ( OutputCommand : command) ;
81
- impl_message_traits ! ( GetLazyStateCommand : command) ;
84
+ impl CommandMessageHeaderEq for OutputCommandMessage {
85
+ fn header_eq ( & self , other : & Self , ignore_payload_checks : bool ) -> bool {
86
+ if ignore_payload_checks {
87
+ self . name == other. name
88
+ && match ( & self . result , & other. result ) {
89
+ (
90
+ Some ( output_command_message:: Result :: Value ( _) ) ,
91
+ Some ( output_command_message:: Result :: Value ( _) ) ,
92
+ ) => true ,
93
+ ( x, y) => x. eq ( y) ,
94
+ }
95
+ } else {
96
+ self . eq ( other)
97
+ }
98
+ }
99
+ }
100
+
101
+ impl_message_traits ! ( GetLazyStateCommand : command eq) ;
82
102
impl_message_traits ! ( GetLazyStateCompletionNotification : notification) ;
103
+
83
104
impl_message_traits ! ( SetStateCommand : command) ;
84
- impl_message_traits ! ( ClearStateCommand : command) ;
85
- impl_message_traits ! ( ClearAllStateCommand : command) ;
86
- impl_message_traits ! ( GetLazyStateKeysCommand : command) ;
105
+ impl CommandMessageHeaderEq for SetStateCommandMessage {
106
+ fn header_eq ( & self , other : & Self , ignore_payload_checks : bool ) -> bool {
107
+ if ignore_payload_checks {
108
+ self . name == other. name
109
+ && self . key == other. key
110
+ && match ( & self . value , & other. value ) {
111
+ ( Some ( _) , Some ( _) ) => true ,
112
+ ( x, y) => x. eq ( y) ,
113
+ }
114
+ } else {
115
+ self . eq ( other)
116
+ }
117
+ }
118
+ }
119
+
120
+ impl_message_traits ! ( ClearStateCommand : command eq) ;
121
+
122
+ impl_message_traits ! ( ClearAllStateCommand : command eq) ;
123
+
124
+ impl_message_traits ! ( GetLazyStateKeysCommand : command eq) ;
87
125
impl_message_traits ! ( GetLazyStateKeysCompletionNotification : notification) ;
126
+
88
127
impl_message_traits ! ( GetEagerStateCommand : command) ;
89
- impl_message_traits ! ( GetEagerStateKeysCommand : command) ;
90
- impl_message_traits ! ( GetPromiseCommand : command) ;
128
+ impl CommandMessageHeaderEq for GetEagerStateCommandMessage {
129
+ fn header_eq ( & self , other : & Self , ignore_payload_checks : bool ) -> bool {
130
+ if ignore_payload_checks {
131
+ self . name == other. name
132
+ && self . key == other. key
133
+ && match ( & self . result , & other. result ) {
134
+ (
135
+ Some ( get_eager_state_command_message:: Result :: Value ( _) ) ,
136
+ Some ( get_eager_state_command_message:: Result :: Value ( _) ) ,
137
+ ) => true ,
138
+ ( x, y) => x. eq ( y) ,
139
+ }
140
+ } else {
141
+ self . eq ( other)
142
+ }
143
+ }
144
+ }
145
+
146
+ impl_message_traits ! ( GetEagerStateKeysCommand : command eq) ;
147
+
148
+ impl_message_traits ! ( GetPromiseCommand : command eq) ;
91
149
impl_message_traits ! ( GetPromiseCompletionNotification : notification) ;
92
- impl_message_traits ! ( PeekPromiseCommand : command) ;
150
+
151
+ impl_message_traits ! ( PeekPromiseCommand : command eq) ;
93
152
impl_message_traits ! ( PeekPromiseCompletionNotification : notification) ;
153
+
94
154
impl_message_traits ! ( CompletePromiseCommand : command) ;
155
+ impl CommandMessageHeaderEq for CompletePromiseCommandMessage {
156
+ fn header_eq ( & self , other : & Self , ignore_payload_checks : bool ) -> bool {
157
+ if ignore_payload_checks {
158
+ self . name == other. name
159
+ && self . key == other. key
160
+ && self . result_completion_id == other. result_completion_id
161
+ && match ( & self . completion , & other. completion ) {
162
+ (
163
+ Some ( complete_promise_command_message:: Completion :: CompletionValue ( _) ) ,
164
+ Some ( complete_promise_command_message:: Completion :: CompletionValue ( _) ) ,
165
+ ) => true ,
166
+ ( x, y) => x. eq ( y) ,
167
+ }
168
+ } else {
169
+ self . eq ( other)
170
+ }
171
+ }
172
+ }
95
173
impl_message_traits ! ( CompletePromiseCompletionNotification : notification) ;
96
174
97
- impl_message_traits ! ( SleepCommand : message) ;
98
- impl_message_traits ! ( SleepCommand : named_command) ;
175
+ impl_message_traits ! ( SleepCommand : command) ;
99
176
impl CommandMessageHeaderEq for SleepCommandMessage {
100
- fn header_eq ( & self , other : & Self ) -> bool {
177
+ fn header_eq ( & self , other : & Self , _ : bool ) -> bool {
101
178
self . name == other. name
102
179
}
103
180
}
104
-
105
181
impl_message_traits ! ( SleepCompletionNotification : notification) ;
182
+
106
183
impl_message_traits ! ( CallCommand : command) ;
184
+ impl CommandMessageHeaderEq for CallCommandMessage {
185
+ fn header_eq ( & self , other : & Self , ignore_payload_checks : bool ) -> bool {
186
+ self . service_name == other. service_name
187
+ && self . handler_name == other. handler_name
188
+ && ( ignore_payload_checks || ( self . parameter == other. parameter ) )
189
+ && self . headers == other. headers
190
+ && self . key == other. key
191
+ && self . idempotency_key == other. idempotency_key
192
+ && self . invocation_id_notification_idx == other. invocation_id_notification_idx
193
+ && self . result_completion_id == other. result_completion_id
194
+ && self . name == other. name
195
+ }
196
+ }
107
197
impl_message_traits ! ( CallInvocationIdCompletionNotification : notification) ;
108
198
impl_message_traits ! ( CallCompletionNotification : notification) ;
109
199
110
- impl_message_traits ! ( OneWayCallCommand : message) ;
111
- impl_message_traits ! ( OneWayCallCommand : named_command) ;
200
+ impl_message_traits ! ( OneWayCallCommand : command) ;
112
201
impl CommandMessageHeaderEq for OneWayCallCommandMessage {
113
- fn header_eq ( & self , other : & Self ) -> bool {
202
+ fn header_eq ( & self , other : & Self , ignore_payload_checks : bool ) -> bool {
114
203
self . service_name == other. service_name
115
204
&& self . handler_name == other. handler_name
116
- && self . key == other. key
205
+ && ( ignore_payload_checks || ( self . parameter == other. parameter ) )
117
206
&& self . headers == other. headers
118
- && self . parameter == other. parameter
207
+ && self . key == other. key
208
+ && self . idempotency_key == other. idempotency_key
209
+ && self . invocation_id_notification_idx == other. invocation_id_notification_idx
119
210
&& self . name == other. name
120
211
}
121
212
}
@@ -128,13 +219,34 @@ impl NamedCommandMessage for SendSignalCommandMessage {
128
219
}
129
220
impl_message_traits ! ( SendSignalCommand : command_header_eq) ;
130
221
131
- impl_message_traits ! ( RunCommand : command) ;
222
+ impl_message_traits ! ( RunCommand : command eq ) ;
132
223
impl_message_traits ! ( RunCompletionNotification : notification) ;
133
- impl_message_traits ! ( AttachInvocationCommand : command) ;
224
+
225
+ impl_message_traits ! ( AttachInvocationCommand : command eq) ;
134
226
impl_message_traits ! ( AttachInvocationCompletionNotification : notification) ;
135
- impl_message_traits ! ( GetInvocationOutputCommand : command) ;
227
+
228
+ impl_message_traits ! ( GetInvocationOutputCommand : command eq) ;
136
229
impl_message_traits ! ( GetInvocationOutputCompletionNotification : notification) ;
230
+
137
231
impl_message_traits ! ( CompleteAwakeableCommand : command) ;
232
+ impl CommandMessageHeaderEq for CompleteAwakeableCommandMessage {
233
+ fn header_eq ( & self , other : & Self , ignore_payload_checks : bool ) -> bool {
234
+ if ignore_payload_checks {
235
+ self . name == other. name
236
+ && self . awakeable_id == other. awakeable_id
237
+ && match ( & self . result , & other. result ) {
238
+ (
239
+ Some ( complete_awakeable_command_message:: Result :: Value ( _) ) ,
240
+ Some ( complete_awakeable_command_message:: Result :: Failure ( _) ) ,
241
+ ) => true ,
242
+ ( x, y) => x. eq ( y) ,
243
+ }
244
+ } else {
245
+ self . eq ( other)
246
+ }
247
+ }
248
+ }
249
+
138
250
impl_message_traits ! ( SignalNotification : notification) ;
139
251
140
252
// --- Diffs and Formatting
0 commit comments