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
/**
* \file wasmtime/store.h
*
* Wasmtime definition of a "store".
*/
extern "C" WASMTIME_FEATURE_GC
WASM_API_EXTERN wasmtime_error_t *
;
/**
* \brief Set fuel to this context's store for wasm to consume while executing.
*
* For this method to work fuel consumption must be enabled via
* #wasmtime_config_consume_fuel_set. By default a store starts with 0 fuel
* for wasm to execute with (meaning it will immediately trap).
* This function must be called for the store to have
* some fuel to allow WebAssembly to execute.
*
* Note that when fuel is entirely consumed it will cause wasm to trap.
*
* If fuel is not enabled within this store then an error is returned. If fuel
* is successfully added then NULL is returned.
*/
WASM_API_EXTERN wasmtime_error_t *
;
/**
* \brief Returns the amount of fuel remaining in this context's store.
*
* If fuel consumption is not enabled via #wasmtime_config_consume_fuel_set
* then this function will return an error. Otherwise `NULL` is returned and the
* fuel parameter is filled in with fuel consumed so far.
*
* Also note that fuel, if enabled, must be originally configured via
* #wasmtime_context_set_fuel.
*/
WASM_API_EXTERN wasmtime_error_t *
;
/**
* \brief Configures WASI state within the specified store.
*
* This function is required if #wasmtime_linker_define_wasi is called. This
* will configure the WASI state for instances defined within this store to the
* configuration specified.
*
* This function does not take ownership of `context` but it does take ownership
* of `wasi`. The caller should no longer use `wasi` after calling this function
* (even if an error is returned).
*/
WASM_API_EXTERN wasmtime_error_t *
;
// WASMTIME_FEATURE_WASI
/**
* \brief Initializes the WASI HTTP context for this store.
*
* Must be called before instantiating a component that uses `wasi:http`.
* Requires WASI to be configured first via #wasmtime_context_set_wasi.
*/
WASM_API_EXTERN void
;
// WASMTIME_FEATURE_WASI_HTTP
/**
* \brief Configures the relative deadline at which point WebAssembly code will
* trap or invoke the callback function.
*
* This function configures the store-local epoch deadline after which point
* WebAssembly code will trap or invoke the callback function.
*
* See also #wasmtime_config_epoch_interruption_set and
* #wasmtime_store_epoch_deadline_callback.
*/
WASM_API_EXTERN void
;
/// \brief An enum for the behavior before extending the epoch deadline.
typedef uint8_t wasmtime_update_deadline_kind_t;
/// \brief Directly continue to updating the deadline and executing WebAssembly.
/// \brief Yield control (via async support) then update the deadline.
/**
* \brief Configures epoch deadline callback to C function.
*
* This function configures a store-local callback function that will be
* called when the running WebAssembly function has exceeded its epoch
* deadline. That function can:
* - return a #wasmtime_error_t to terminate the function
* - set the delta argument and return NULL to update the
* epoch deadline delta and resume function execution.
* - set the delta argument, update the epoch deadline,
* set update_kind to WASMTIME_UPDATE_DEADLINE_YIELD,
* and return NULL to yield (via async support) and
* resume function execution.
*
* To use WASMTIME_UPDATE_DEADLINE_YIELD async support must be enabled
* for this store.
*
* See also #wasmtime_config_epoch_interruption_set and
* #wasmtime_context_set_epoch_deadline.
*/
WASM_API_EXTERN void ;
} // extern "C"
// WASMTIME_STORE_H