@@ -7,7 +7,7 @@ use api_helper::{anchor::WatchIndexQuery, ctx::Ctx};
7
7
use futures_util:: { StreamExt , TryStreamExt } ;
8
8
use proto:: backend;
9
9
use rivet_api:: {
10
- apis:: { actors_api , configuration:: Configuration } ,
10
+ apis:: { actors_v1_api , configuration:: Configuration } ,
11
11
models,
12
12
} ;
13
13
use rivet_operation:: prelude:: * ;
@@ -29,7 +29,7 @@ pub mod metrics;
29
29
pub struct GlobalEndpointTypeQuery {
30
30
#[ serde( flatten) ]
31
31
global : GlobalQuery ,
32
- endpoint_type : Option < models:: ActorsEndpointType > ,
32
+ endpoint_type : Option < models:: ActorsV1EndpointType > ,
33
33
}
34
34
35
35
// MARK: GET /actors/{}
@@ -39,7 +39,7 @@ pub async fn get(
39
39
actor_id : Uuid ,
40
40
watch_index : WatchIndexQuery ,
41
41
query : GlobalEndpointTypeQuery ,
42
- ) -> GlobalResult < models:: ActorsGetActorResponse > {
42
+ ) -> GlobalResult < models:: ActorsV1GetActorResponse > {
43
43
get_inner ( & ctx, actor_id, watch_index, query) . await
44
44
}
45
45
@@ -48,7 +48,7 @@ async fn get_inner(
48
48
actor_id : Uuid ,
49
49
_watch_index : WatchIndexQuery ,
50
50
query : GlobalEndpointTypeQuery ,
51
- ) -> GlobalResult < models:: ActorsGetActorResponse > {
51
+ ) -> GlobalResult < models:: ActorsV1GetActorResponse > {
52
52
let CheckOutput { game_id, .. } = ctx
53
53
. auth ( )
54
54
. check (
@@ -105,8 +105,8 @@ async fn get_inner(
105
105
} ;
106
106
107
107
// Pass the request to the edge api
108
- use actors_api :: ActorsGetError :: * ;
109
- match actors_api :: actors_get (
108
+ use actors_v1_api :: ActorsV1GetError :: * ;
109
+ match actors_v1_api :: actors_v1_get (
110
110
& config,
111
111
& actor_id. to_string ( ) ,
112
112
query. global . project . as_deref ( ) ,
@@ -196,9 +196,9 @@ pub async fn get_deprecated(
196
196
#[ tracing:: instrument( skip_all) ]
197
197
pub async fn create (
198
198
ctx : Ctx < Auth > ,
199
- body : models:: ActorsCreateActorRequest ,
199
+ body : models:: ActorsV1CreateActorRequest ,
200
200
query : GlobalEndpointTypeQuery ,
201
- ) -> GlobalResult < models:: ActorsCreateActorResponse > {
201
+ ) -> GlobalResult < models:: ActorsV1CreateActorResponse > {
202
202
let CheckOutput { game_id, .. } = ctx
203
203
. auth ( )
204
204
. check (
@@ -227,8 +227,8 @@ pub async fn create(
227
227
} ;
228
228
229
229
// Pass the request to the edge api
230
- use actors_api :: ActorsCreateError :: * ;
231
- match actors_api :: actors_create (
230
+ use actors_v1_api :: ActorsV1CreateError :: * ;
231
+ match actors_v1_api :: actors_v1_create (
232
232
& config,
233
233
body,
234
234
query. global . project . as_deref ( ) ,
@@ -272,18 +272,18 @@ pub async fn create_deprecated(
272
272
let global = build_global_query_compat ( & ctx, game_id, env_id) . await ?;
273
273
let create_res = create (
274
274
ctx,
275
- models:: ActorsCreateActorRequest {
275
+ models:: ActorsV1CreateActorRequest {
276
276
region : Some ( dc. name_id . clone ( ) ) ,
277
277
lifecycle : body. lifecycle . map ( |l| {
278
- Box :: new ( models:: ActorsLifecycle {
278
+ Box :: new ( models:: ActorsV1Lifecycle {
279
279
kill_timeout : l. kill_timeout ,
280
280
durable : Some ( false ) ,
281
281
} )
282
282
} ) ,
283
- network : Some ( Box :: new ( models:: ActorsCreateActorNetworkRequest {
283
+ network : Some ( Box :: new ( models:: ActorsV1CreateActorNetworkRequest {
284
284
mode : body. network . mode . map ( |n| match n {
285
- models:: ServersNetworkMode :: Host => models:: ActorsNetworkMode :: Host ,
286
- models:: ServersNetworkMode :: Bridge => models:: ActorsNetworkMode :: Bridge ,
285
+ models:: ServersNetworkMode :: Host => models:: ActorsV1NetworkMode :: Host ,
286
+ models:: ServersNetworkMode :: Bridge => models:: ActorsV1NetworkMode :: Bridge ,
287
287
} ) ,
288
288
ports : Some (
289
289
body. network
@@ -292,30 +292,30 @@ pub async fn create_deprecated(
292
292
. map ( |( k, p) | {
293
293
(
294
294
k,
295
- models:: ActorsCreateActorPortRequest {
295
+ models:: ActorsV1CreateActorPortRequest {
296
296
internal_port : p. internal_port ,
297
297
protocol : match p. protocol {
298
298
models:: ServersPortProtocol :: Http => {
299
- models:: ActorsPortProtocol :: Http
299
+ models:: ActorsV1PortProtocol :: Http
300
300
}
301
301
models:: ServersPortProtocol :: Https => {
302
- models:: ActorsPortProtocol :: Https
302
+ models:: ActorsV1PortProtocol :: Https
303
303
}
304
304
models:: ServersPortProtocol :: Tcp => {
305
- models:: ActorsPortProtocol :: Tcp
305
+ models:: ActorsV1PortProtocol :: Tcp
306
306
}
307
307
models:: ServersPortProtocol :: TcpTls => {
308
- models:: ActorsPortProtocol :: TcpTls
308
+ models:: ActorsV1PortProtocol :: TcpTls
309
309
}
310
310
models:: ServersPortProtocol :: Udp => {
311
- models:: ActorsPortProtocol :: Udp
311
+ models:: ActorsV1PortProtocol :: Udp
312
312
}
313
313
} ,
314
314
routing : p. routing . map ( |r| {
315
- Box :: new ( models:: ActorsPortRouting {
315
+ Box :: new ( models:: ActorsV1PortRouting {
316
316
// Temporarily disabled
317
317
// guard: r.game_guard.map(|_| {
318
- // Box::new(models::ActorsGuardRouting ::default())
318
+ // Box::new(models::ActorsV1GuardRouting ::default())
319
319
// }),
320
320
guard : r. game_guard . map ( |_| json ! ( { } ) ) ,
321
321
host : r. host . map ( |_| json ! ( { } ) ) ,
@@ -328,7 +328,11 @@ pub async fn create_deprecated(
328
328
) ,
329
329
wait_ready : None ,
330
330
} ) ) ,
331
- runtime : Some ( Box :: new ( models:: ActorsCreateActorRuntimeRequest {
331
+ resources : Some ( Box :: new ( models:: ActorsV1Resources {
332
+ cpu : body. resources . cpu ,
333
+ memory : body. resources . memory ,
334
+ } ) ) ,
335
+ runtime : Some ( Box :: new ( models:: ActorsV1CreateActorRuntimeRequest {
332
336
environment : body. runtime . environment ,
333
337
network : None ,
334
338
} ) ) ,
@@ -418,8 +422,8 @@ pub async fn destroy(
418
422
} ;
419
423
420
424
// Pass the request to the edge api
421
- use actors_api :: ActorsDestroyError :: * ;
422
- match actors_api :: actors_destroy (
425
+ use actors_v1_api :: ActorsV1DestroyError :: * ;
426
+ match actors_v1_api :: actors_v1_destroy (
423
427
& config,
424
428
& actor_id. to_string ( ) ,
425
429
query. global . project . as_deref ( ) ,
@@ -493,7 +497,7 @@ pub async fn destroy_deprecated(
493
497
pub async fn upgrade (
494
498
ctx : Ctx < Auth > ,
495
499
actor_id : Uuid ,
496
- body : models:: ActorsUpgradeActorRequest ,
500
+ body : models:: ActorsV1UpgradeActorRequest ,
497
501
query : GlobalQuery ,
498
502
) -> GlobalResult < serde_json:: Value > {
499
503
let CheckOutput { game_id, .. } = ctx
@@ -552,8 +556,8 @@ pub async fn upgrade(
552
556
} ;
553
557
554
558
// Pass the request to the edge api
555
- use actors_api :: ActorsUpgradeError :: * ;
556
- match actors_api :: actors_upgrade (
559
+ use actors_v1_api :: ActorsV1UpgradeError :: * ;
560
+ match actors_v1_api :: actors_v1_upgrade (
557
561
& config,
558
562
& actor_id. to_string ( ) ,
559
563
body. clone ( ) ,
@@ -598,9 +602,9 @@ pub async fn upgrade(
598
602
#[ tracing:: instrument( skip_all) ]
599
603
pub async fn upgrade_all (
600
604
ctx : Ctx < Auth > ,
601
- body : models:: ActorsUpgradeAllActorsRequest ,
605
+ body : models:: ActorsV1UpgradeAllActorsRequest ,
602
606
query : GlobalQuery ,
603
- ) -> GlobalResult < models:: ActorsUpgradeAllActorsResponse > {
607
+ ) -> GlobalResult < models:: ActorsV1UpgradeAllActorsResponse > {
604
608
let CheckOutput { game_id, .. } = ctx
605
609
. auth ( )
606
610
. check (
@@ -697,8 +701,8 @@ pub async fn upgrade_all(
697
701
} ;
698
702
699
703
// Pass the request to the edge api
700
- use actors_api :: ActorsUpgradeAllError :: * ;
701
- match actors_api :: actors_upgrade_all (
704
+ use actors_v1_api :: ActorsV1UpgradeAllError :: * ;
705
+ match actors_v1_api :: actors_v1_upgrade_all (
702
706
& config,
703
707
body. clone ( ) ,
704
708
query. project . as_deref ( ) ,
@@ -731,7 +735,7 @@ pub async fn upgrade_all(
731
735
. try_fold ( 0 , |a, res| std:: future:: ready ( Ok ( a + res. count ) ) )
732
736
. await ?;
733
737
734
- Ok ( models:: ActorsUpgradeAllActorsResponse { count } )
738
+ Ok ( models:: ActorsV1UpgradeAllActorsResponse { count } )
735
739
}
736
740
737
741
// MARK: GET /actors
@@ -749,15 +753,15 @@ pub async fn list_actors(
749
753
ctx : Ctx < Auth > ,
750
754
watch_index : WatchIndexQuery ,
751
755
query : ListQuery ,
752
- ) -> GlobalResult < models:: ActorsListActorsResponse > {
756
+ ) -> GlobalResult < models:: ActorsV1ListActorsResponse > {
753
757
list_actors_inner ( & ctx, watch_index, query) . await
754
758
}
755
759
756
760
async fn list_actors_inner (
757
761
ctx : & Ctx < Auth > ,
758
762
_watch_index : WatchIndexQuery ,
759
763
query : ListQuery ,
760
- ) -> GlobalResult < models:: ActorsListActorsResponse > {
764
+ ) -> GlobalResult < models:: ActorsV1ListActorsResponse > {
761
765
let CheckOutput { game_id, .. } = ctx
762
766
. auth ( )
763
767
. check (
@@ -863,7 +867,7 @@ async fn list_actors_inner(
863
867
// Pass the request to the edge api
864
868
let timeout_res = tokio:: time:: timeout (
865
869
Duration :: from_secs ( 30 ) ,
866
- actors_api :: actors_list (
870
+ actors_v1_api :: actors_v1_list (
867
871
& config,
868
872
query. global_endpoint_type . global . project . as_deref ( ) ,
869
873
query. global_endpoint_type . global . environment . as_deref ( ) ,
@@ -876,7 +880,7 @@ async fn list_actors_inner(
876
880
)
877
881
. await ;
878
882
879
- use actors_api :: ActorsListError :: * ;
883
+ use actors_v1_api :: ActorsV1ListError :: * ;
880
884
match timeout_res {
881
885
Ok ( timeout_res) => match timeout_res {
882
886
Ok ( res) => Ok ( res) ,
@@ -943,7 +947,7 @@ async fn list_actors_inner(
943
947
unix_ts. to_string ( )
944
948
} ) ;
945
949
946
- Ok ( models:: ActorsListActorsResponse {
950
+ Ok ( models:: ActorsV1ListActorsResponse {
947
951
actors,
948
952
pagination : Box :: new ( models:: Pagination { cursor } ) ,
949
953
} )
@@ -1014,7 +1018,7 @@ pub async fn list_servers_deprecated(
1014
1018
}
1015
1019
1016
1020
fn legacy_convert_actor_to_server (
1017
- a : models:: ActorsActor ,
1021
+ a : models:: ActorsV1Actor ,
1018
1022
datacenter : & cluster:: types:: Datacenter ,
1019
1023
) -> GlobalResult < models:: ServersServer > {
1020
1024
Ok ( models:: ServersServer {
@@ -1033,14 +1037,14 @@ fn legacy_convert_actor_to_server(
1033
1037
} )
1034
1038
. transpose ( ) ?,
1035
1039
environment : Uuid :: nil ( ) ,
1036
- id : util :: uuid :: parse ( & a. id ) ? ,
1040
+ id : a. id . into ( ) ,
1037
1041
lifecycle : Box :: new ( models:: ServersLifecycle {
1038
1042
kill_timeout : a. lifecycle . kill_timeout ,
1039
1043
} ) ,
1040
1044
network : Box :: new ( models:: ServersNetwork {
1041
1045
mode : Some ( match a. network . mode {
1042
- models:: ActorsNetworkMode :: Host => models:: ServersNetworkMode :: Host ,
1043
- models:: ActorsNetworkMode :: Bridge => models:: ServersNetworkMode :: Bridge ,
1046
+ models:: ActorsV1NetworkMode :: Host => models:: ServersNetworkMode :: Host ,
1047
+ models:: ActorsV1NetworkMode :: Bridge => models:: ServersNetworkMode :: Bridge ,
1044
1048
} ) ,
1045
1049
ports : a
1046
1050
. network
@@ -1052,17 +1056,21 @@ fn legacy_convert_actor_to_server(
1052
1056
models:: ServersPort {
1053
1057
internal_port : p. internal_port ,
1054
1058
protocol : match p. protocol {
1055
- models:: ActorsPortProtocol :: Http => {
1059
+ models:: ActorsV1PortProtocol :: Http => {
1056
1060
models:: ServersPortProtocol :: Http
1057
1061
}
1058
- models:: ActorsPortProtocol :: Https => {
1062
+ models:: ActorsV1PortProtocol :: Https => {
1059
1063
models:: ServersPortProtocol :: Https
1060
1064
}
1061
- models:: ActorsPortProtocol :: Tcp => models:: ServersPortProtocol :: Tcp ,
1062
- models:: ActorsPortProtocol :: TcpTls => {
1065
+ models:: ActorsV1PortProtocol :: Tcp => {
1066
+ models:: ServersPortProtocol :: Tcp
1067
+ }
1068
+ models:: ActorsV1PortProtocol :: TcpTls => {
1063
1069
models:: ServersPortProtocol :: TcpTls
1064
1070
}
1065
- models:: ActorsPortProtocol :: Udp => models:: ServersPortProtocol :: Udp ,
1071
+ models:: ActorsV1PortProtocol :: Udp => {
1072
+ models:: ServersPortProtocol :: Udp
1073
+ }
1066
1074
} ,
1067
1075
public_hostname : p. hostname ,
1068
1076
public_port : p. port ,
0 commit comments