@@ -10,10 +10,12 @@ use common::{
10
10
CanonicalizedComponentFunctionPath ,
11
11
ComponentId ,
12
12
} ,
13
+ http:: ResolvedHost ,
13
14
pause:: PauseClient ,
14
15
runtime:: Runtime ,
15
16
types:: {
16
17
AllowedVisibility ,
18
+ ConvexOrigin ,
17
19
FunctionCaller ,
18
20
RepeatableTimestamp ,
19
21
} ,
@@ -89,14 +91,14 @@ pub enum ExecuteQueryTimestamp {
89
91
pub trait ApplicationApi : Send + Sync {
90
92
async fn authenticate (
91
93
& self ,
92
- host : & str ,
94
+ host : & ResolvedHost ,
93
95
request_id : RequestId ,
94
96
auth_token : AuthenticationToken ,
95
97
) -> anyhow:: Result < Identity > ;
96
98
97
99
async fn execute_public_query (
98
100
& self ,
99
- host : & str ,
101
+ host : & ResolvedHost ,
100
102
request_id : RequestId ,
101
103
identity : Identity ,
102
104
path : CanonicalizedComponentFunctionPath ,
@@ -108,7 +110,7 @@ pub trait ApplicationApi: Send + Sync {
108
110
109
111
async fn execute_public_mutation (
110
112
& self ,
111
- host : & str ,
113
+ host : & ResolvedHost ,
112
114
request_id : RequestId ,
113
115
identity : Identity ,
114
116
path : CanonicalizedComponentFunctionPath ,
@@ -120,7 +122,7 @@ pub trait ApplicationApi: Send + Sync {
120
122
121
123
async fn execute_public_action (
122
124
& self ,
123
- host : & str ,
125
+ host : & ResolvedHost ,
124
126
request_id : RequestId ,
125
127
identity : Identity ,
126
128
path : CanonicalizedComponentFunctionPath ,
@@ -130,7 +132,7 @@ pub trait ApplicationApi: Send + Sync {
130
132
131
133
async fn execute_any_function (
132
134
& self ,
133
- host : & str ,
135
+ host : & ResolvedHost ,
134
136
request_id : RequestId ,
135
137
identity : Identity ,
136
138
path : CanonicalizedComponentFunctionPath ,
@@ -140,13 +142,13 @@ pub trait ApplicationApi: Send + Sync {
140
142
141
143
async fn latest_timestamp (
142
144
& self ,
143
- host : & str ,
145
+ host : & ResolvedHost ,
144
146
request_id : RequestId ,
145
147
) -> anyhow:: Result < RepeatableTimestamp > ;
146
148
147
149
async fn execute_http_action (
148
150
& self ,
149
- host : & str ,
151
+ host : & ResolvedHost ,
150
152
request_id : RequestId ,
151
153
http_request_metadata : HttpActionRequest ,
152
154
identity : Identity ,
@@ -156,16 +158,17 @@ pub trait ApplicationApi: Send + Sync {
156
158
157
159
async fn check_store_file_authorization (
158
160
& self ,
159
- host : & str ,
161
+ host : & ResolvedHost ,
160
162
request_id : RequestId ,
161
163
token : & str ,
162
164
validity : Duration ,
163
165
) -> anyhow:: Result < ComponentId > ;
164
166
165
167
async fn store_file (
166
168
& self ,
167
- host : & str ,
169
+ host : & ResolvedHost ,
168
170
request_id : RequestId ,
171
+ origin : ConvexOrigin ,
169
172
component : ComponentId ,
170
173
content_length : Option < ContentLength > ,
171
174
content_type : Option < ContentType > ,
@@ -175,17 +178,19 @@ pub trait ApplicationApi: Send + Sync {
175
178
176
179
async fn get_file_range (
177
180
& self ,
178
- host : & str ,
181
+ host : & ResolvedHost ,
179
182
request_id : RequestId ,
183
+ origin : ConvexOrigin ,
180
184
component : ComponentId ,
181
185
file_storage_id : FileStorageId ,
182
186
range : ( Bound < u64 > , Bound < u64 > ) ,
183
187
) -> anyhow:: Result < FileRangeStream > ;
184
188
185
189
async fn get_file (
186
190
& self ,
187
- host : & str ,
191
+ host : & ResolvedHost ,
188
192
request_id : RequestId ,
193
+ origin : ConvexOrigin ,
189
194
component : ComponentId ,
190
195
file_storage_id : FileStorageId ,
191
196
) -> anyhow:: Result < FileStream > ;
@@ -197,15 +202,18 @@ pub trait ApplicationApi: Send + Sync {
197
202
// socket connection. NOTE: We might eventually strengthen the requirement for
198
203
// the implementation and require it to reconnect internally but easier to
199
204
// start this way.
200
- async fn subscription_client ( & self , host : & str ) -> anyhow:: Result < Box < dyn SubscriptionClient > > ;
205
+ async fn subscription_client (
206
+ & self ,
207
+ host : & ResolvedHost ,
208
+ ) -> anyhow:: Result < Box < dyn SubscriptionClient > > ;
201
209
}
202
210
203
211
// Implements ApplicationApi via Application.
204
212
#[ async_trait]
205
213
impl < RT : Runtime > ApplicationApi for Application < RT > {
206
214
async fn authenticate (
207
215
& self ,
208
- _host : & str ,
216
+ _host : & ResolvedHost ,
209
217
_request_id : RequestId ,
210
218
auth_token : AuthenticationToken ,
211
219
) -> anyhow:: Result < Identity > {
@@ -215,7 +223,7 @@ impl<RT: Runtime> ApplicationApi for Application<RT> {
215
223
216
224
async fn execute_public_query (
217
225
& self ,
218
- _host : & str ,
226
+ _host : & ResolvedHost ,
219
227
request_id : RequestId ,
220
228
identity : Identity ,
221
229
path : CanonicalizedComponentFunctionPath ,
@@ -239,7 +247,7 @@ impl<RT: Runtime> ApplicationApi for Application<RT> {
239
247
240
248
async fn execute_public_mutation (
241
249
& self ,
242
- _host : & str ,
250
+ _host : & ResolvedHost ,
243
251
request_id : RequestId ,
244
252
identity : Identity ,
245
253
path : CanonicalizedComponentFunctionPath ,
@@ -267,7 +275,7 @@ impl<RT: Runtime> ApplicationApi for Application<RT> {
267
275
268
276
async fn execute_public_action (
269
277
& self ,
270
- _host : & str ,
278
+ _host : & ResolvedHost ,
271
279
request_id : RequestId ,
272
280
identity : Identity ,
273
281
path : CanonicalizedComponentFunctionPath ,
@@ -285,7 +293,7 @@ impl<RT: Runtime> ApplicationApi for Application<RT> {
285
293
286
294
async fn execute_any_function (
287
295
& self ,
288
- _host : & str ,
296
+ _host : & ResolvedHost ,
289
297
request_id : RequestId ,
290
298
identity : Identity ,
291
299
path : CanonicalizedComponentFunctionPath ,
@@ -297,15 +305,15 @@ impl<RT: Runtime> ApplicationApi for Application<RT> {
297
305
298
306
async fn latest_timestamp (
299
307
& self ,
300
- _host : & str ,
308
+ _host : & ResolvedHost ,
301
309
_request_id : RequestId ,
302
310
) -> anyhow:: Result < RepeatableTimestamp > {
303
311
Ok ( self . now_ts_for_reads ( ) )
304
312
}
305
313
306
314
async fn execute_http_action (
307
315
& self ,
308
- _host : & str ,
316
+ _host : & ResolvedHost ,
309
317
request_id : RequestId ,
310
318
http_request_metadata : HttpActionRequest ,
311
319
identity : Identity ,
@@ -324,7 +332,7 @@ impl<RT: Runtime> ApplicationApi for Application<RT> {
324
332
325
333
async fn check_store_file_authorization (
326
334
& self ,
327
- _host : & str ,
335
+ _host : & ResolvedHost ,
328
336
_request_id : RequestId ,
329
337
token : & str ,
330
338
validity : Duration ,
@@ -335,8 +343,9 @@ impl<RT: Runtime> ApplicationApi for Application<RT> {
335
343
336
344
async fn store_file (
337
345
& self ,
338
- _host : & str ,
346
+ _host : & ResolvedHost ,
339
347
_request_id : RequestId ,
348
+ _origin : ConvexOrigin ,
340
349
component : ComponentId ,
341
350
content_length : Option < ContentLength > ,
342
351
content_type : Option < ContentType > ,
@@ -355,8 +364,9 @@ impl<RT: Runtime> ApplicationApi for Application<RT> {
355
364
356
365
async fn get_file_range (
357
366
& self ,
358
- _host : & str ,
367
+ _host : & ResolvedHost ,
359
368
_request_id : RequestId ,
369
+ _origin : ConvexOrigin ,
360
370
component : ComponentId ,
361
371
file_storage_id : FileStorageId ,
362
372
range : ( Bound < u64 > , Bound < u64 > ) ,
@@ -366,8 +376,9 @@ impl<RT: Runtime> ApplicationApi for Application<RT> {
366
376
367
377
async fn get_file (
368
378
& self ,
369
- _host : & str ,
379
+ _host : & ResolvedHost ,
370
380
_request_id : RequestId ,
381
+ _origin : ConvexOrigin ,
371
382
component : ComponentId ,
372
383
file_storage_id : FileStorageId ,
373
384
) -> anyhow:: Result < FileStream > {
@@ -376,7 +387,7 @@ impl<RT: Runtime> ApplicationApi for Application<RT> {
376
387
377
388
async fn subscription_client (
378
389
& self ,
379
- _host : & str ,
390
+ _host : & ResolvedHost ,
380
391
) -> anyhow:: Result < Box < dyn SubscriptionClient > > {
381
392
Ok ( Box :: new ( ApplicationSubscriptionClient {
382
393
database : self . database . clone ( ) ,
0 commit comments