-
Notifications
You must be signed in to change notification settings - Fork 1
/
typenames.witx
276 lines (254 loc) · 8.9 KB
/
typenames.witx
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
;; Type names used by Envoy ABI.
;;
;; This is a `witx` file. See [here](https://github.com/WebAssembly/WASI/tree/master/docs/witx.md)
;; for an explanation of what that means.
;;; Error codes returned by ABI functions.
(typename $wasm_result
(enum u32
;;; No error occurred. ABI call completed successfully.
$ok
;;; The result could not be found, e.g. a provided key did not appear in a table.
$not_found
;;; An argument was bad, e.g. did not conform to the required range.
$bad_argument
;;; A protobuf could not be serialized.
$serialization_failure
;;; A protobuf could not be parsed.
$parse_failure
;;; A provided expression (e.g. "foo.bar") was illegal or unrecognized.
$bad_expression
;;; A provided memory range was not legal.
$invalid_memory_access
;;; Data was requested from an empty container.
$empty
;;; The provided CAS did not match that of the stored data.
$cas_mismatch
;;; Returned result was unexpected, e.g. of the incorrect size.
$result_mismatch
;;; Internal failure: trying check logs of the surrounding system.
$internal_failure
;;; The connection/stream/pipe was broken/closed unexpectedly.
$broken_connection
)
)
;;; Peer type.
(typename $peer_type
(enum u32
;;; Unknown.
$unknown
;;; Local.
$local
;;; Remote.
$remote
)
)
;;; Status codes returned by filters that can cause future filters to not get iterated to.
(typename $filter_status
(enum u32
;;; Continue to further filters.
$continue
;;; Stop executing further filters.
$stop_iteration
)
)
;;; Return codes for encode/decode headers filter invocations. The connection manager bases further
;;; filter invocations on the return code of the previous filter.
(typename $filter_headers_status
(enum u32
;;; Continue filter chain iteration.
$continue
;;; Do not iterate to any of the remaining filters in the chain. Returning
;;; FilterDataStatus::Continue from decodeData()/encodeData() or calling
;;; continueDecoding()/continueEncoding() MUST be called if continued filter iteration is desired.
$stop_iteration
;;; TODO(up-to-date): Envoy API (include/envoy/http) has more variants than Envoy ABI (api/wasm/cpp)
)
)
;;; Return codes for encode/decode data filter invocations. The connection manager bases further
;;; filter invocations on the return code of the previous filter.
(typename $filter_data_status
(enum u32
;;; Continue filter chain iteration. If headers have not yet been sent to the next filter, they
;;; will be sent first via decodeHeaders()/encodeHeaders(). If data has previously been buffered,
;;; the data in this callback will be added to the buffer before the entirety is sent to the next
;;; filter.
$continue
;;; Do not iterate to any of the remaining filters in the chain, and buffer body data for later
;;; dispatching. Returning FilterDataStatus::Continue from decodeData()/encodeData() or calling
;;; continueDecoding()/continueEncoding() MUST be called if continued filter iteration is desired.
;;;
;;; This should be called by filters which must parse a larger block of the incoming data before
;;; continuing processing and so can not push back on streaming data via watermarks.
;;;
;;; If buffering the request causes buffered data to exceed the configured buffer limit, a 413 will
;;; be sent to the user. On the response path exceeding buffer limits will result in a 500.
$stop_iteration_and_buffer
;;; Do not iterate to any of the remaining filters in the chain, and buffer body data for later
;;; dispatching. Returning FilterDataStatus::Continue from decodeData()/encodeData() or calling
;;; continueDecoding()/continueEncoding() MUST be called if continued filter iteration is desired.
;;;
;;; This will cause the flow of incoming data to cease until one of the continue.*() functions is
;;; called.
;;;
;;; This should be returned by filters which can nominally stream data but have a transient back-up
;;; such as the configured delay of the fault filter, or if the router filter is still fetching an
;;; upstream connection.
$stop_iteration_and_watermark
;;; Do not iterate to any of the remaining filters in the chain, but do not buffer any of the
;;; body data for later dispatching. Returning FilterDataStatus::Continue from
;;; decodeData()/encodeData() or calling continueDecoding()/continueEncoding() MUST be called if
;;; continued filter iteration is desired.
$stop_iteration_no_buffer
)
)
;;; Return codes for encode/decode trailers filter invocations. The connection manager bases further
;;; filter invocations on the return code of the previous filter.
(typename $filter_trailers_status
(enum u32
;;; Continue filter chain iteration.
$continue
;;; Do not iterate to any of the remaining filters in the chain. Calling
;;; continueDecoding()/continueEncoding() MUST be called if continued filter iteration is desired.
$stop_iteration
)
)
;;; Return codes for encode metadata filter invocations. Metadata currently can not stop filter
;;; iteration.
(typename $filter_metadata_status
(enum u32
;;; Continue filter chain iteration.
$continue
)
)
;;; Type of a header map.
(typename $headers_type
(enum u32
;;; Request headers of a proxied HTTP request.
$request_headers
;;; Request trailers of a proxied HTTP request.
$request_trailers
;;; Response headers of a proxied HTTP request.
$response_headers
;;; Response trailers of a proxied HTTP request.
$response_trailers
;;; Client's initial metadata of an outgoing gRPC call.
$grpc_create_initial_metadata
;;; Server's initial metadata of an outgoing gRPC call.
$grpc_receive_initial_metadata
;;; Server's trailing metadata of an outgoing gRPC call.
$grpc_receive_trailing_metadata
;;; Response headers of an outgoing HTTP request.
$http_call_response_headers
;;; Response trailers of an outgoing HTTP request.
$http_call_response_trailers
)
)
;;; Type of payload in a buffer.
(typename $buffer_type
(enum u32
;;; Request body of a proxied HTTP request.
$http_request_body
;;; Response body of a proxied HTTP request.
$http_response_body
;;; Request payload of a proxied L4 connection.
$network_downstream_data
;;; Response payload of a proxied L4 connection.
$network_upstream_data
;;; Response body of an outgoing HTTP request.
$http_call_response_body
;;; Response payload of an outgoing gRPC call.
$grpc_receive_buffer
)
)
;;; Buffer flags.
(typename $buffer_flags
(flags u32
;;; End of stream has been reached.
$end_of_stream
)
)
;;; Size of data in a linear memory.
(typename $size u32)
;;; Size of a header map, e.g. request headers, response trailers, etc.
(typename $map_size u32)
;;; Unique identifier of a root/connection/request context.
(typename $context_id (handle))
;;; Opaque identifier of an outgoing HTTP request, gRPC call, etc.
(typename $token (handle))
;;; Metric handle.
(typename $metric_id (handle))
;;; Metric type.
(typename $metric_type
(enum u32
;;; Counter.
$counter
;;; Gauge.
$gauge
;;; Histogram.
$histogram
)
)
;;; Boolean true or false.
(typename $boolean u32)
;;; Timestamp in nanoseconds.
(typename $timestamp u64)
;;; Well-known gRPC statuses.
(typename $grpc_status
;;; notice that Envoy C ABI uses `int32_t` type, but `witx` doesn't allow to use `s32` for `enum`
(enum u32
;;; The RPC completed successfully.
$ok
;;; The RPC was canceled.
$canceled
;;; Some unknown error occurred.
$unknown
;;; An argument to the RPC was invalid.
$invalid_argument
;;; The deadline for the RPC expired before the RPC completed.
$deadline_exceeded
;;; Some resource for the RPC was not found.
$not_found
;;; A resource the RPC attempted to create already exists.
$already_exists
;;; Permission was denied for the RPC.
$permission_denied
;;; Some resource is exhausted, resulting in RPC failure.
$resource_exhausted
;;; Some precondition for the RPC failed.
$failed_precondition
;;; The RPC was aborted.
$aborted
;;; Some operation was requested outside of a legal range.
$out_of_range
;;; The RPC requested was not implemented.
$unimplemented
;;; Some internal error occurred.
$internal
;;; The RPC endpoint is current unavailable.
$unavailable
;;; There was some data loss resulting in RPC failure.
$data_loss
;;; The RPC does not have required credentials for the RPC to succeed.
$unauthenticated
;;; This is a non-GRPC error code, indicating the status code in gRPC headers
;;; was invalid.
$invalid_code
)
)
;;; Log level.
(typename $log_level
(enum u32
;;; Trace.
$trace
;;; Debug.
$debug
;;; Info.
$info
;;; Warn.
$warn
;;; Error.
$error
;;; Critical.
$critical
)
)