@@ -37,7 +37,6 @@ namespace Aws
37
37
namespace Eventstreamrpc
38
38
{
39
39
class EventStreamHeader ;
40
- class EventStreamRpcClient ;
41
40
class MessageAmendment ;
42
41
class ClientConnection ;
43
42
class ClientContinuation ;
@@ -46,19 +45,28 @@ namespace Aws
46
45
using HeaderValueType = aws_event_stream_header_value_type;
47
46
using MessageType = aws_event_stream_rpc_message_type;
48
47
48
+ /* *
49
+ * A callback prototype that is called upon flushing a message over the wire.
50
+ * @param errorCode A non-zero value if an error occured while attempting to flush the message.
51
+ */
49
52
using OnMessageFlushCallback = std::function<void (int errorCode)>;
50
53
51
54
/* *
52
- * Allows the application to append headers and change the payload of the CONNECT
53
- * packet being sent out.
55
+ * Allows the application to add headers and change the payload of the CONNECT
56
+ * packet sent out by the client.
57
+ * @return The `MessageAmendment` for the client to use during an attempt to connect.
54
58
*/
55
59
using ConnectMessageAmender = std::function<MessageAmendment &(void )>;
56
60
61
+ /* *
62
+ * A wrapper around an `aws_event_stream_header_value_pair` object.
63
+ */
57
64
class AWS_EVENTSTREAMRPC_API EventStreamHeader final
58
65
{
59
66
public:
60
67
EventStreamHeader (const EventStreamHeader &lhs) noexcept ;
61
68
EventStreamHeader (EventStreamHeader &&rhs) noexcept ;
69
+ EventStreamHeader &operator =(const EventStreamHeader &lhs) noexcept ;
62
70
~EventStreamHeader () noexcept ;
63
71
EventStreamHeader (
64
72
const struct aws_event_stream_header_value_pair &header,
@@ -100,13 +108,19 @@ namespace Aws
100
108
struct aws_event_stream_header_value_pair m_underlyingHandle;
101
109
};
102
110
111
+ /* *
112
+ * A means to append headers or modify the payload of a message to be sent by the client.
113
+ * @note The exception specifiers for move, copy constructors & assignment operators are required since
114
+ * this class is usually wrapped with `Crt::Optional`.
115
+ */
103
116
class AWS_EVENTSTREAMRPC_API MessageAmendment final
104
117
{
105
118
public:
106
119
MessageAmendment (const MessageAmendment &lhs) = default ;
107
120
MessageAmendment (MessageAmendment &&rhs) = default ;
121
+ MessageAmendment &operator =(const MessageAmendment &rhs) = default ;
108
122
~MessageAmendment () noexcept ;
109
- explicit MessageAmendment (Crt::Allocator *allocator = Crt::g_allocator);
123
+ explicit MessageAmendment (Crt::Allocator *allocator = Crt::g_allocator) noexcept ;
110
124
MessageAmendment (
111
125
const Crt::List<EventStreamHeader> &headers,
112
126
Crt::Optional<Crt::ByteBuf> &payload,
@@ -129,57 +143,11 @@ namespace Aws
129
143
Crt::Allocator *m_allocator;
130
144
};
131
145
132
- class AWS_CRT_CPP_API UnixSocketResolver final : public Crt::Io::HostResolver
133
- {
134
- public:
135
- /* *
136
- * Resolves UNIX sockets.
137
- */
138
- UnixSocketResolver (
139
- Crt::Io::EventLoopGroup &elGroup,
140
- size_t maxHosts,
141
- Crt::Allocator *allocator = Crt::g_allocator) noexcept ;
142
- ~UnixSocketResolver ();
143
- UnixSocketResolver (const UnixSocketResolver &) = delete ;
144
- UnixSocketResolver &operator =(const UnixSocketResolver &) = delete ;
145
- UnixSocketResolver (UnixSocketResolver &&) = delete ;
146
- UnixSocketResolver &operator =(UnixSocketResolver &&) = delete ;
147
-
148
- bool ResolveHost (const Crt::String &host, const Crt::Io::OnHostResolved &onResolved) noexcept override ;
149
-
150
- /* *
151
- * @return true if the instance is in a valid state, false otherwise.
152
- */
153
- operator bool () const noexcept { return m_initialized; }
154
- /* *
155
- * @return the value of the last aws error encountered by operations on this instance.
156
- */
157
- int LastError () const noexcept { return aws_last_error (); }
158
-
159
- // / @private
160
- aws_host_resolver *GetUnderlyingHandle () noexcept override { return m_resolver; }
161
- // / @private
162
- aws_host_resolution_config *GetConfig () noexcept override { return NULL ; }
163
-
164
- private:
165
- aws_host_resolver *m_resolver;
166
- Crt::Allocator *m_allocator;
167
- bool m_initialized;
168
-
169
- static void s_onHostResolved (
170
- struct aws_host_resolver *resolver,
171
- const struct aws_string *host_name,
172
- int err_code,
173
- const struct aws_array_list *host_addresses,
174
- void *user_data);
175
- };
176
-
177
146
/* *
178
147
* Configuration structure holding all options relating to eventstream RPC connection establishment
179
148
*/
180
149
struct AWS_EVENTSTREAMRPC_API ClientConnectionOptions final
181
150
{
182
- public:
183
151
ClientConnectionOptions ();
184
152
ClientConnectionOptions (const ClientConnectionOptions &rhs) = default ;
185
153
ClientConnectionOptions (ClientConnectionOptions &&rhs) = default ;
@@ -258,7 +226,6 @@ namespace Aws
258
226
EVENT_STREAM_RPC_UNMAPPED_DATA,
259
227
EVENT_STREAM_RPC_UNSUPPORTED_CONTENT_TYPE,
260
228
EVENT_STREAM_RPC_STREAM_CLOSED_PREMATURELY,
261
- EVENT_STREAM_RPC_UNEXPECTED_ERROR,
262
229
EVENT_STREAM_RPC_CRT_ERROR
263
230
};
264
231
@@ -273,15 +240,15 @@ namespace Aws
273
240
{
274
241
/* A wrapper around std::promise so that it cannot be set twice without having to catch exceptions. */
275
242
public:
276
- ProtectedPromise () noexcept ;
277
- ProtectedPromise (const ProtectedPromise &lhs) noexcept = delete ;
278
- ProtectedPromise (ProtectedPromise &&rhs) noexcept ;
279
- ProtectedPromise &operator =(ProtectedPromise &&) noexcept ;
280
- ProtectedPromise (std::promise<T> &&promise) noexcept ;
281
- void SetValue (T &&r) noexcept ;
282
- void SetValue (const T &r) noexcept ;
283
- std::future<T> GetFuture () noexcept ;
284
- void Reset () noexcept ;
243
+ ProtectedPromise ();
244
+ ProtectedPromise (const ProtectedPromise &lhs) = delete ;
245
+ ProtectedPromise (ProtectedPromise &&rhs);
246
+ ProtectedPromise &operator =(ProtectedPromise &&);
247
+ ProtectedPromise (std::promise<T> &&promise);
248
+ void SetValue (T &&r);
249
+ void SetValue (const T &r);
250
+ std::future<T> GetFuture ();
251
+ void Reset ();
285
252
286
253
private:
287
254
bool m_fulfilled;
@@ -332,7 +299,6 @@ namespace Aws
332
299
enum ClientState
333
300
{
334
301
DISCONNECTED = 1 ,
335
- CONNECTING_TO_SOCKET,
336
302
WAITING_FOR_CONNECT_ACK,
337
303
CONNECTED,
338
304
DISCONNECTING,
@@ -428,7 +394,7 @@ namespace Aws
428
394
class AWS_EVENTSTREAMRPC_API AbstractShapeBase
429
395
{
430
396
public:
431
- AbstractShapeBase (Crt::Allocator *allocator = Crt::g_allocator ) noexcept ;
397
+ AbstractShapeBase () noexcept ;
432
398
virtual ~AbstractShapeBase () noexcept ;
433
399
static void s_customDeleter (AbstractShapeBase *shape) noexcept ;
434
400
virtual void SerializeToJsonObject (Crt::JsonObject &payloadObject) const = 0;
@@ -441,7 +407,7 @@ namespace Aws
441
407
class AWS_EVENTSTREAMRPC_API OperationResponse : public AbstractShapeBase
442
408
{
443
409
public:
444
- OperationResponse (Crt::Allocator *allocator = Crt::g_allocator ) noexcept ;
410
+ OperationResponse () noexcept ;
445
411
static void s_customDeleter (OperationResponse *shape) noexcept ;
446
412
/* A response does not necessarily have to be serialized so provide a default implementation. */
447
413
virtual void SerializeToJsonObject (Crt::JsonObject &payloadObject) const override ;
@@ -450,13 +416,13 @@ namespace Aws
450
416
class AWS_EVENTSTREAMRPC_API OperationRequest : public AbstractShapeBase
451
417
{
452
418
public:
453
- OperationRequest (Crt::Allocator *allocator = Crt::g_allocator ) noexcept ;
419
+ OperationRequest () noexcept ;
454
420
};
455
421
456
422
class AWS_EVENTSTREAMRPC_API OperationError : public AbstractShapeBase
457
423
{
458
424
public:
459
- explicit OperationError (Crt::Allocator *allocator = Crt::g_allocator ) noexcept ;
425
+ explicit OperationError () noexcept ;
460
426
static void s_customDeleter (OperationError *shape) noexcept ;
461
427
virtual void SerializeToJsonObject (Crt::JsonObject &payloadObject) const override ;
462
428
virtual Crt::Optional<Crt::String> GetMessage () noexcept = 0;
0 commit comments