@@ -7,7 +7,7 @@ use api_helper::{anchor::WatchIndexQuery, ctx::Ctx};
77use futures_util:: { StreamExt , TryStreamExt } ;
88use proto:: backend;
99use rivet_api:: {
10- apis:: { actors_api , configuration:: Configuration } ,
10+ apis:: { actors_v1_api , configuration:: Configuration } ,
1111 models,
1212} ;
1313use rivet_operation:: prelude:: * ;
@@ -29,7 +29,7 @@ pub mod metrics;
2929pub struct GlobalEndpointTypeQuery {
3030 #[ serde( flatten) ]
3131 global : GlobalQuery ,
32- endpoint_type : Option < models:: ActorsEndpointType > ,
32+ endpoint_type : Option < models:: ActorsV1EndpointType > ,
3333}
3434
3535// MARK: GET /actors/{}
@@ -39,7 +39,7 @@ pub async fn get(
3939 actor_id : Uuid ,
4040 watch_index : WatchIndexQuery ,
4141 query : GlobalEndpointTypeQuery ,
42- ) -> GlobalResult < models:: ActorsGetActorResponse > {
42+ ) -> GlobalResult < models:: ActorsV1GetActorResponse > {
4343 get_inner ( & ctx, actor_id, watch_index, query) . await
4444}
4545
@@ -48,7 +48,7 @@ async fn get_inner(
4848 actor_id : Uuid ,
4949 _watch_index : WatchIndexQuery ,
5050 query : GlobalEndpointTypeQuery ,
51- ) -> GlobalResult < models:: ActorsGetActorResponse > {
51+ ) -> GlobalResult < models:: ActorsV1GetActorResponse > {
5252 let CheckOutput { game_id, .. } = ctx
5353 . auth ( )
5454 . check (
@@ -105,8 +105,8 @@ async fn get_inner(
105105 } ;
106106
107107 // 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 (
110110 & config,
111111 & actor_id. to_string ( ) ,
112112 query. global . project . as_deref ( ) ,
@@ -196,9 +196,9 @@ pub async fn get_deprecated(
196196#[ tracing:: instrument( skip_all) ]
197197pub async fn create (
198198 ctx : Ctx < Auth > ,
199- body : models:: ActorsCreateActorRequest ,
199+ body : models:: ActorsV1CreateActorRequest ,
200200 query : GlobalEndpointTypeQuery ,
201- ) -> GlobalResult < models:: ActorsCreateActorResponse > {
201+ ) -> GlobalResult < models:: ActorsV1CreateActorResponse > {
202202 let CheckOutput { game_id, .. } = ctx
203203 . auth ( )
204204 . check (
@@ -227,8 +227,8 @@ pub async fn create(
227227 } ;
228228
229229 // 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 (
232232 & config,
233233 body,
234234 query. global . project . as_deref ( ) ,
@@ -272,18 +272,18 @@ pub async fn create_deprecated(
272272 let global = build_global_query_compat ( & ctx, game_id, env_id) . await ?;
273273 let create_res = create (
274274 ctx,
275- models:: ActorsCreateActorRequest {
275+ models:: ActorsV1CreateActorRequest {
276276 region : Some ( dc. name_id . clone ( ) ) ,
277277 lifecycle : body. lifecycle . map ( |l| {
278- Box :: new ( models:: ActorsLifecycle {
278+ Box :: new ( models:: ActorsV1Lifecycle {
279279 kill_timeout : l. kill_timeout ,
280280 durable : Some ( false ) ,
281281 } )
282282 } ) ,
283- network : Some ( Box :: new ( models:: ActorsCreateActorNetworkRequest {
283+ network : Some ( Box :: new ( models:: ActorsV1CreateActorNetworkRequest {
284284 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 ,
287287 } ) ,
288288 ports : Some (
289289 body. network
@@ -292,30 +292,30 @@ pub async fn create_deprecated(
292292 . map ( |( k, p) | {
293293 (
294294 k,
295- models:: ActorsCreateActorPortRequest {
295+ models:: ActorsV1CreateActorPortRequest {
296296 internal_port : p. internal_port ,
297297 protocol : match p. protocol {
298298 models:: ServersPortProtocol :: Http => {
299- models:: ActorsPortProtocol :: Http
299+ models:: ActorsV1PortProtocol :: Http
300300 }
301301 models:: ServersPortProtocol :: Https => {
302- models:: ActorsPortProtocol :: Https
302+ models:: ActorsV1PortProtocol :: Https
303303 }
304304 models:: ServersPortProtocol :: Tcp => {
305- models:: ActorsPortProtocol :: Tcp
305+ models:: ActorsV1PortProtocol :: Tcp
306306 }
307307 models:: ServersPortProtocol :: TcpTls => {
308- models:: ActorsPortProtocol :: TcpTls
308+ models:: ActorsV1PortProtocol :: TcpTls
309309 }
310310 models:: ServersPortProtocol :: Udp => {
311- models:: ActorsPortProtocol :: Udp
311+ models:: ActorsV1PortProtocol :: Udp
312312 }
313313 } ,
314314 routing : p. routing . map ( |r| {
315- Box :: new ( models:: ActorsPortRouting {
315+ Box :: new ( models:: ActorsV1PortRouting {
316316 // Temporarily disabled
317317 // guard: r.game_guard.map(|_| {
318- // Box::new(models::ActorsGuardRouting ::default())
318+ // Box::new(models::ActorsV1GuardRouting ::default())
319319 // }),
320320 guard : r. game_guard . map ( |_| json ! ( { } ) ) ,
321321 host : r. host . map ( |_| json ! ( { } ) ) ,
@@ -328,7 +328,11 @@ pub async fn create_deprecated(
328328 ) ,
329329 wait_ready : None ,
330330 } ) ) ,
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 {
332336 environment : body. runtime . environment ,
333337 network : None ,
334338 } ) ) ,
@@ -418,8 +422,8 @@ pub async fn destroy(
418422 } ;
419423
420424 // 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 (
423427 & config,
424428 & actor_id. to_string ( ) ,
425429 query. global . project . as_deref ( ) ,
@@ -493,7 +497,7 @@ pub async fn destroy_deprecated(
493497pub async fn upgrade (
494498 ctx : Ctx < Auth > ,
495499 actor_id : Uuid ,
496- body : models:: ActorsUpgradeActorRequest ,
500+ body : models:: ActorsV1UpgradeActorRequest ,
497501 query : GlobalQuery ,
498502) -> GlobalResult < serde_json:: Value > {
499503 let CheckOutput { game_id, .. } = ctx
@@ -552,8 +556,8 @@ pub async fn upgrade(
552556 } ;
553557
554558 // 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 (
557561 & config,
558562 & actor_id. to_string ( ) ,
559563 body. clone ( ) ,
@@ -598,9 +602,9 @@ pub async fn upgrade(
598602#[ tracing:: instrument( skip_all) ]
599603pub async fn upgrade_all (
600604 ctx : Ctx < Auth > ,
601- body : models:: ActorsUpgradeAllActorsRequest ,
605+ body : models:: ActorsV1UpgradeAllActorsRequest ,
602606 query : GlobalQuery ,
603- ) -> GlobalResult < models:: ActorsUpgradeAllActorsResponse > {
607+ ) -> GlobalResult < models:: ActorsV1UpgradeAllActorsResponse > {
604608 let CheckOutput { game_id, .. } = ctx
605609 . auth ( )
606610 . check (
@@ -697,8 +701,8 @@ pub async fn upgrade_all(
697701 } ;
698702
699703 // 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 (
702706 & config,
703707 body. clone ( ) ,
704708 query. project . as_deref ( ) ,
@@ -731,7 +735,7 @@ pub async fn upgrade_all(
731735 . try_fold ( 0 , |a, res| std:: future:: ready ( Ok ( a + res. count ) ) )
732736 . await ?;
733737
734- Ok ( models:: ActorsUpgradeAllActorsResponse { count } )
738+ Ok ( models:: ActorsV1UpgradeAllActorsResponse { count } )
735739}
736740
737741// MARK: GET /actors
@@ -749,15 +753,15 @@ pub async fn list_actors(
749753 ctx : Ctx < Auth > ,
750754 watch_index : WatchIndexQuery ,
751755 query : ListQuery ,
752- ) -> GlobalResult < models:: ActorsListActorsResponse > {
756+ ) -> GlobalResult < models:: ActorsV1ListActorsResponse > {
753757 list_actors_inner ( & ctx, watch_index, query) . await
754758}
755759
756760async fn list_actors_inner (
757761 ctx : & Ctx < Auth > ,
758762 _watch_index : WatchIndexQuery ,
759763 query : ListQuery ,
760- ) -> GlobalResult < models:: ActorsListActorsResponse > {
764+ ) -> GlobalResult < models:: ActorsV1ListActorsResponse > {
761765 let CheckOutput { game_id, .. } = ctx
762766 . auth ( )
763767 . check (
@@ -863,7 +867,7 @@ async fn list_actors_inner(
863867 // Pass the request to the edge api
864868 let timeout_res = tokio:: time:: timeout (
865869 Duration :: from_secs ( 30 ) ,
866- actors_api :: actors_list (
870+ actors_v1_api :: actors_v1_list (
867871 & config,
868872 query. global_endpoint_type . global . project . as_deref ( ) ,
869873 query. global_endpoint_type . global . environment . as_deref ( ) ,
@@ -876,7 +880,7 @@ async fn list_actors_inner(
876880 )
877881 . await ;
878882
879- use actors_api :: ActorsListError :: * ;
883+ use actors_v1_api :: ActorsV1ListError :: * ;
880884 match timeout_res {
881885 Ok ( timeout_res) => match timeout_res {
882886 Ok ( res) => Ok ( res) ,
@@ -943,7 +947,7 @@ async fn list_actors_inner(
943947 unix_ts. to_string ( )
944948 } ) ;
945949
946- Ok ( models:: ActorsListActorsResponse {
950+ Ok ( models:: ActorsV1ListActorsResponse {
947951 actors,
948952 pagination : Box :: new ( models:: Pagination { cursor } ) ,
949953 } )
@@ -1014,7 +1018,7 @@ pub async fn list_servers_deprecated(
10141018}
10151019
10161020fn legacy_convert_actor_to_server (
1017- a : models:: ActorsActor ,
1021+ a : models:: ActorsV1Actor ,
10181022 datacenter : & cluster:: types:: Datacenter ,
10191023) -> GlobalResult < models:: ServersServer > {
10201024 Ok ( models:: ServersServer {
@@ -1033,14 +1037,14 @@ fn legacy_convert_actor_to_server(
10331037 } )
10341038 . transpose ( ) ?,
10351039 environment : Uuid :: nil ( ) ,
1036- id : util :: uuid :: parse ( & a. id ) ? ,
1040+ id : a. id . into ( ) ,
10371041 lifecycle : Box :: new ( models:: ServersLifecycle {
10381042 kill_timeout : a. lifecycle . kill_timeout ,
10391043 } ) ,
10401044 network : Box :: new ( models:: ServersNetwork {
10411045 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 ,
10441048 } ) ,
10451049 ports : a
10461050 . network
@@ -1052,17 +1056,21 @@ fn legacy_convert_actor_to_server(
10521056 models:: ServersPort {
10531057 internal_port : p. internal_port ,
10541058 protocol : match p. protocol {
1055- models:: ActorsPortProtocol :: Http => {
1059+ models:: ActorsV1PortProtocol :: Http => {
10561060 models:: ServersPortProtocol :: Http
10571061 }
1058- models:: ActorsPortProtocol :: Https => {
1062+ models:: ActorsV1PortProtocol :: Https => {
10591063 models:: ServersPortProtocol :: Https
10601064 }
1061- models:: ActorsPortProtocol :: Tcp => models:: ServersPortProtocol :: Tcp ,
1062- models:: ActorsPortProtocol :: TcpTls => {
1065+ models:: ActorsV1PortProtocol :: Tcp => {
1066+ models:: ServersPortProtocol :: Tcp
1067+ }
1068+ models:: ActorsV1PortProtocol :: TcpTls => {
10631069 models:: ServersPortProtocol :: TcpTls
10641070 }
1065- models:: ActorsPortProtocol :: Udp => models:: ServersPortProtocol :: Udp ,
1071+ models:: ActorsV1PortProtocol :: Udp => {
1072+ models:: ServersPortProtocol :: Udp
1073+ }
10661074 } ,
10671075 public_hostname : p. hostname ,
10681076 public_port : p. port ,
0 commit comments