-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnats.status.pas
251 lines (221 loc) · 18.3 KB
/
nats.status.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
unit nats.status;
{$IFDEF FPC}
{$mode delphi}
{$ENDIF}
interface
// MIT License
//
// Copyright (c) 2022 Vahid Nasehi Oskouei
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
type
/// The connection state
natsConnStatus = (
NATS_CONN_STATUS_DISCONNECTED = 0, ///< The connection has been disconnected
NATS_CONN_STATUS_CONNECTING, ///< The connection is in the process or connecting
NATS_CONN_STATUS_CONNECTED, ///< The connection is connected
NATS_CONN_STATUS_CLOSED, ///< The connection is closed
NATS_CONN_STATUS_RECONNECTING, ///< The connection is in the process or reconnecting
NATS_CONN_STATUS_DRAINING_SUBS, ///< The connection is draining subscriptions
NATS_CONN_STATUS_DRAINING_PUBS ///< The connection is draining publishers
);
/// Status returned by most of the APIs
PnatsStatus = ^natsStatus;
natsStatus = (
NATS_OK = 0, ///< Success
NATS_ERR, ///< Generic error
NATS_PROTOCOL_ERROR, ///< Error when parsing a protocol message,
/// or not getting the expected message.
NATS_IO_ERROR, ///< IO Error (network communication).
NATS_LINE_TOO_LONG, ///< The protocol message read from the socket
/// does not fit in the read buffer.
NATS_CONNECTION_CLOSED, ///< Operation on this connection failed because
/// the connection is closed.
NATS_NO_SERVER, ///< Unable to connect, the server could not be
/// reached or is not running.
NATS_STALE_CONNECTION, ///< The server closed our connection because it
/// did not receive PINGs at the expected interval.
NATS_SECURE_CONNECTION_WANTED, ///< The client is configured to use TLS, but the
/// server is not.
NATS_SECURE_CONNECTION_REQUIRED, ///< The server expects a TLS connection.
NATS_CONNECTION_DISCONNECTED, ///< The connection was disconnected. Depending on
/// the configuration, the connection may reconnect.
NATS_CONNECTION_AUTH_FAILED, ///< The connection failed due to authentication error.
NATS_NOT_PERMITTED, ///< The action is not permitted.
NATS_NOT_FOUND, ///< An action could not complete because something
/// was not found. So far, this is an internal error.
NATS_ADDRESS_MISSING, ///< Incorrect URL. For instance no host specified in
/// the URL.
NATS_INVALID_SUBJECT, ///< Invalid subject, for instance NULL or empty string.
NATS_INVALID_ARG, ///< An invalid argument is passed to a function. For
/// instance passing NULL to an API that does not
/// accept this value.
NATS_INVALID_SUBSCRIPTION, ///< The call to a subscription function fails because
/// the subscription has previously been closed.
NATS_INVALID_TIMEOUT, ///< Timeout must be positive numbers.
NATS_ILLEGAL_STATE, ///< An unexpected state, for instance calling
/// #natsSubscription_NextMsg() on an asynchronous
/// subscriber.
NATS_SLOW_CONSUMER, ///< The maximum number of messages waiting to be
/// delivered has been reached. Messages are dropped.
NATS_MAX_PAYLOAD, ///< Attempt to send a payload larger than the maximum
/// allowed by the NATS Server.
NATS_MAX_DELIVERED_MSGS, ///< Attempt to receive more messages than allowed, for
/// instance because of #natsSubscription_AutoUnsubscribe().
NATS_INSUFFICIENT_BUFFER, ///< A buffer is not large enough to accommodate the data.
NATS_NO_MEMORY, ///< An operation could not complete because of insufficient
/// memory.
NATS_SYS_ERROR, ///< Some system function returned an error.
NATS_TIMEOUT, ///< An operation timed-out. For instance
/// #natsSubscription_NextMsg().
NATS_FAILED_TO_INITIALIZE, ///< The library failed to initialize.
NATS_NOT_INITIALIZED, ///< The library is not yet initialized.
NATS_SSL_ERROR, ///< An SSL error occurred when trying to establish a
/// connection.
NATS_NO_SERVER_SUPPORT, ///< The server does not support this action.
NATS_NOT_YET_CONNECTED, ///< A connection could not be immediately established and
/// #natsOptions_SetRetryOnFailedConnect() specified
/// a connected callback. The connect is retried asynchronously.
NATS_DRAINING, ///< A connection and/or subscription entered the draining mode.
/// Some operations will fail when in that mode.
NATS_INVALID_QUEUE_NAME, ///< An invalid queue name was passed when creating a queue subscription.
NATS_NO_RESPONDERS, ///< No responders were running when the server received the request.
NATS_MISMATCH, ///< For JetStream subscriptions, it means that a consumer sequence mismatch was discovered.
NATS_MISSED_HEARTBEAT ///< For JetStream subscriptions, it means that the library detected that server heartbeats have been missed.
);
PjsErrCode = ^jsErrCode;
jsErrCode = (
JSAccountResourcesExceededErr = 10002, ///< Resource limits exceeded for account
JSBadRequestErr = 10003, ///< Bad request
JSClusterIncompleteErr = 10004, ///< Incomplete results
JSClusterNoPeersErr = 10005, ///< No suitable peers for placement
JSClusterNotActiveErr = 10006, ///< JetStream not in clustered mode
JSClusterNotAssignedErr = 10007, ///< JetStream cluster not assigned to this server
JSClusterNotAvailErr = 10008, ///< JetStream system temporarily unavailable
JSClusterNotLeaderErr = 10009, ///< JetStream cluster can not handle request
JSClusterRequiredErr = 10010, ///< JetStream clustering support required
JSClusterTagsErr = 10011, ///< Tags placement not supported for operation
JSConsumerCreateErr = 10012, ///< General consumer creation failure string
JSConsumerNameExistErr = 10013, ///< Consumer name already in use
JSConsumerNotFoundErr = 10014, ///< Consumer not found
JSSnapshotDeliverSubjectInvalidErr = 10015, ///< Deliver subject not valid
JSConsumerDurableNameNotInSubjectErr = 10016, ///< Consumer expected to be durable but no durable name set in subject
JSConsumerDurableNameNotMatchSubjectErr = 10017, ///< Consumer name in subject does not match durable name in request
JSConsumerDurableNameNotSetErr = 10018, ///< Consumer expected to be durable but a durable name was not set
JSConsumerEphemeralWithDurableInSubjectErr = 10019, ///< Consumer expected to be ephemeral but detected a durable name set in subject
JSConsumerEphemeralWithDurableNameErr = 10020, ///< Consumer expected to be ephemeral but a durable name was set in request
JSStreamExternalApiOverlapErr = 10021, ///< Stream external api prefix must not overlap
JSStreamExternalDelPrefixOverlapsErr = 10022, ///< Stream external delivery prefix overlaps with stream subject
JSInsufficientResourcesErr = 10023, ///< Insufficient resources
JSStreamInvalidExternalDeliverySubjErr = 10024, ///< Stream external delivery prefix must not contain wildcards
JSInvalidJSONErr = 10025, ///< Invalid JSON
JSMaximumConsumersLimitErr = 10026, ///< Maximum consumers exceeds account limit
JSMaximumStreamsLimitErr = 10027, ///< Maximum number of streams reached
JSMemoryResourcesExceededErr = 10028, ///< Insufficient memory resources available
JSMirrorConsumerSetupFailedErr = 10029, ///< Generic mirror consumer setup failure
JSMirrorMaxMessageSizeTooBigErr = 10030, ///< Stream mirror must have max message size >= source
JSMirrorWithSourcesErr = 10031, ///< Stream mirrors can not also contain other sources
JSMirrorWithStartSeqAndTimeErr = 10032, ///< Stream mirrors can not have both start seq and start time configured
JSMirrorWithSubjectFiltersErr = 10033, ///< Stream mirrors can not contain filtered subjects
JSMirrorWithSubjectsErr = 10034, ///< Stream mirrors can not also contain subjects
JSNoAccountErr = 10035, ///< Account not found
JSClusterUnSupportFeatureErr = 10036, ///< Not currently supported in clustered mode
JSNoMessageFoundErr = 10037, ///< No message found
JSNotEmptyRequestErr = 10038, ///< Expected an empty request payload
JSNotEnabledForAccountErr = 10039, ///< JetStream not enabled for account
JSClusterPeerNotMemberErr = 10040, ///< Peer not a member
JSRaftGeneralErr = 10041, ///< General RAFT error
JSRestoreSubscribeFailedErr = 10042, ///< JetStream unable to subscribe to restore snapshot
JSSequenceNotFoundErr = 10043, ///< Sequence not found
JSClusterServerNotMemberErr = 10044, ///< Server is not a member of the cluster
JSSourceConsumerSetupFailedErr = 10045, ///< General source consumer setup failure
JSSourceMaxMessageSizeTooBigErr = 10046, ///< Stream source must have max message size >= target
JSStorageResourcesExceededErr = 10047, ///< Insufficient storage resources available
JSStreamAssignmentErr = 10048, ///< Generic stream assignment error
JSStreamCreateErr = 10049, ///< Generic stream creation error
JSStreamDeleteErr = 10050, ///< General stream deletion error
JSStreamGeneralError = 10051, ///< General stream failure
JSStreamInvalidConfig = 10052, ///< Stream configuration validation error
JSStreamLimitsErr = 10053, ///< General stream limits exceeded error
JSStreamMessageExceedsMaximumErr = 10054, ///< Message size exceeds maximum allowed
JSStreamMirrorNotUpdatableErr = 10055, ///< Mirror configuration can not be updated
JSStreamMismatchErr = 10056, ///< Stream name in subject does not match request
JSStreamMsgDeleteFailed = 10057, ///< Generic message deletion failure error
JSStreamNameExistErr = 10058, ///< Stream name already in use
JSStreamNotFoundErr = 10059, ///< Stream not found
JSStreamNotMatchErr = 10060, ///< Expected stream does not match
JSStreamReplicasNotUpdatableErr = 10061, ///< Replicas configuration can not be updated
JSStreamRestoreErr = 10062, ///< Restore failed
JSStreamSequenceNotMatchErr = 10063, ///< Expected stream sequence does not match
JSStreamSnapshotErr = 10064, ///< Snapshot failed
JSStreamSubjectOverlapErr = 10065, ///< Subjects overlap with an existing stream
JSStreamTemplateCreateErr = 10066, ///< Generic template creation failed
JSStreamTemplateDeleteErr = 10067, ///< Generic stream template deletion failed error
JSStreamTemplateNotFoundErr = 10068, ///< Template not found
JSStreamUpdateErr = 10069, ///< Generic stream update error
JSStreamWrongLastMsgIDErr = 10070, ///< Wrong last msg ID
JSStreamWrongLastSequenceErr = 10071, ///< Wrong last sequence
JSTempStorageFailedErr = 10072, ///< JetStream unable to open temp storage for restore
JSTemplateNameNotMatchSubjectErr = 10073, ///< Template name in subject does not match request
JSStreamReplicasNotSupportedErr = 10074, ///< Replicas > 1 not supported in non-clustered mode
JSPeerRemapErr = 10075, ///< Peer remap failed
JSNotEnabledErr = 10076, ///< JetStream not enabled
JSStreamStoreFailedErr = 10077, ///< Generic error when storing a message failed
JSConsumerConfigRequiredErr = 10078, ///< Consumer config required
JSConsumerDeliverToWildcardsErr = 10079, ///< Consumer deliver subject has wildcards
JSConsumerPushMaxWaitingErr = 10080, ///< Consumer in push mode can not set max waiting
JSConsumerDeliverCycleErr = 10081, ///< Consumer deliver subject forms a cycle
JSConsumerMaxPendingAckPolicyRequiredErr = 10082, ///< Consumer requires ack policy for max ack pending
JSConsumerSmallHeartbeatErr = 10083, ///< Consumer idle heartbeat needs to be >= 100ms
JSConsumerPullRequiresAckErr = 10084, ///< Consumer in pull mode requires explicit ack policy
JSConsumerPullNotDurableErr = 10085, ///< Consumer in pull mode requires a durable name
JSConsumerPullWithRateLimitErr = 10086, ///< Consumer in pull mode can not have rate limit set
JSConsumerMaxWaitingNegativeErr = 10087, ///< Consumer max waiting needs to be positive
JSConsumerHBRequiresPushErr = 10088, ///< Consumer idle heartbeat requires a push based consumer
JSConsumerFCRequiresPushErr = 10089, ///< Consumer flow control requires a push based consumer
JSConsumerDirectRequiresPushErr = 10090, ///< Consumer direct requires a push based consumer
JSConsumerDirectRequiresEphemeralErr = 10091, ///< Consumer direct requires an ephemeral consumer
JSConsumerOnMappedErr = 10092, ///< Consumer direct on a mapped consumer
JSConsumerFilterNotSubsetErr = 10093, ///< Consumer filter subject is not a valid subset of the interest subjects
JSConsumerInvalidPolicyErr = 10094, ///< Generic delivery policy error
JSConsumerInvalidSamplingErr = 10095, ///< Failed to parse consumer sampling configuration
JSStreamInvalidErr = 10096, ///< Stream not valid
JSConsumerWQRequiresExplicitAckErr = 10098, ///< Workqueue stream requires explicit ack
JSConsumerWQMultipleUnfilteredErr = 10099, ///< Multiple non-filtered consumers not allowed on workqueue stream
JSConsumerWQConsumerNotUniqueErr = 10100, ///< Filtered consumer not unique on workqueue stream
JSConsumerWQConsumerNotDeliverAllErr = 10101, ///< Consumer must be deliver all on workqueue stream
JSConsumerNameTooLongErr = 10102, ///< Consumer name is too long
JSConsumerBadDurableNameErr = 10103, ///< Durable name can not contain '.', '*', '>'
JSConsumerStoreFailedErr = 10104, ///< Error creating store for consumer
JSConsumerExistingActiveErr = 10105, ///< Consumer already exists and is still active
JSConsumerReplacementWithDifferentNameErr = 10106, ///< Consumer replacement durable config not the same
JSConsumerDescriptionTooLongErr = 10107, ///< Consumer description is too long
JSConsumerWithFlowControlNeedsHeartbeatsErr = 10108,///< Consumer with flow control also needs heartbeats
JSStreamSealedErr = 10109, ///< Invalid operation on sealed stream
JSStreamPurgeFailedErr = 10110, ///< Generic stream purge failure
JSStreamRollupFailedErr = 10111, ///< Generic stream rollup failure
JSConsumerInvalidDeliverSubjectErr = 10112, ///< Invalid push consumer deliver subject
JSStreamMaxBytesRequiredErr = 10113, ///< Account requires a stream config to have max bytes set
JSConsumerMaxRequestBatchNegativeErr = 10114, ///< Consumer max request batch needs to be > 0
JSConsumerMaxRequestExpiresToSmallErr = 10115, ///< Consumer max request expires needs to be > 1ms
JSConsumerMaxDeliverBackoffErr = 10116, ///< Max deliver is required to be > length of backoff values
JSStreamInfoMaxSubjectsErr = 10117 ///< Subject details would exceed maximum allowed
);
implementation
end.