11use gas:: prelude:: * ;
2- use rivet_data:: generated:: pegboard_runner_address_v1;
3- use rivet_runner_protocol:: protocol;
42use rivet_util:: Id ;
53use serde:: { Deserialize , Serialize } ;
6- use std:: ops:: Deref ;
74use utoipa:: ToSchema ;
85
96#[ derive( Debug , Clone , Serialize , Deserialize , ToSchema ) ]
@@ -17,9 +14,6 @@ pub struct Runner {
1714 pub version : u32 ,
1815 pub total_slots : u32 ,
1916 pub remaining_slots : u32 ,
20- pub addresses_http : StringHttpAddressHashableMap ,
21- pub addresses_tcp : StringTcpAddressHashableMap ,
22- pub addresses_udp : StringUdpAddressHashableMap ,
2317 pub create_ts : i64 ,
2418 pub drain_ts : Option < i64 > ,
2519 pub stop_ts : Option < i64 > ,
@@ -28,97 +22,3 @@ pub struct Runner {
2822 pub last_rtt : u32 ,
2923 pub metadata : Option < serde_json:: Map < String , serde_json:: Value > > ,
3024}
31-
32- // HACK: We can't define ToSchema on HashableMap directly, so we have to define concrete types
33- #[ derive( Debug , Clone , Serialize , Deserialize ) ]
34- pub struct StringHttpAddressHashableMap (
35- util:: serde:: HashableMap < String , pegboard_runner_address_v1:: Http > ,
36- ) ;
37-
38- impl From < util:: serde:: HashableMap < String , pegboard_runner_address_v1:: Http > >
39- for StringHttpAddressHashableMap
40- {
41- fn from ( value : util:: serde:: HashableMap < String , pegboard_runner_address_v1:: Http > ) -> Self {
42- Self ( value)
43- }
44- }
45-
46- impl Deref for StringHttpAddressHashableMap {
47- type Target = util:: serde:: HashableMap < String , pegboard_runner_address_v1:: Http > ;
48-
49- fn deref ( & self ) -> & Self :: Target {
50- & self . 0
51- }
52- }
53-
54- impl utoipa:: ToSchema for StringHttpAddressHashableMap { }
55-
56- impl utoipa:: PartialSchema for StringHttpAddressHashableMap {
57- fn schema ( ) -> utoipa:: openapi:: RefOr < utoipa:: openapi:: schema:: Schema > {
58- utoipa:: openapi:: ObjectBuilder :: new ( )
59- . additional_properties ( Some ( protocol:: RunnerAddressHttp :: schema ( ) ) )
60- . into ( )
61- }
62- }
63-
64- #[ derive( Debug , Clone , Serialize , Deserialize ) ]
65- pub struct StringTcpAddressHashableMap (
66- util:: serde:: HashableMap < String , pegboard_runner_address_v1:: Tcp > ,
67- ) ;
68-
69- impl From < util:: serde:: HashableMap < String , pegboard_runner_address_v1:: Tcp > >
70- for StringTcpAddressHashableMap
71- {
72- fn from ( value : util:: serde:: HashableMap < String , pegboard_runner_address_v1:: Tcp > ) -> Self {
73- Self ( value)
74- }
75- }
76-
77- impl Deref for StringTcpAddressHashableMap {
78- type Target = util:: serde:: HashableMap < String , pegboard_runner_address_v1:: Tcp > ;
79-
80- fn deref ( & self ) -> & Self :: Target {
81- & self . 0
82- }
83- }
84-
85- impl utoipa:: ToSchema for StringTcpAddressHashableMap { }
86-
87- impl utoipa:: PartialSchema for StringTcpAddressHashableMap {
88- fn schema ( ) -> utoipa:: openapi:: RefOr < utoipa:: openapi:: schema:: Schema > {
89- utoipa:: openapi:: ObjectBuilder :: new ( )
90- . additional_properties ( Some ( protocol:: RunnerAddressTcp :: schema ( ) ) )
91- . into ( )
92- }
93- }
94-
95- #[ derive( Debug , Clone , Serialize , Deserialize ) ]
96- pub struct StringUdpAddressHashableMap (
97- util:: serde:: HashableMap < String , pegboard_runner_address_v1:: Udp > ,
98- ) ;
99-
100- impl From < util:: serde:: HashableMap < String , pegboard_runner_address_v1:: Udp > >
101- for StringUdpAddressHashableMap
102- {
103- fn from ( value : util:: serde:: HashableMap < String , pegboard_runner_address_v1:: Udp > ) -> Self {
104- Self ( value)
105- }
106- }
107-
108- impl Deref for StringUdpAddressHashableMap {
109- type Target = util:: serde:: HashableMap < String , pegboard_runner_address_v1:: Udp > ;
110-
111- fn deref ( & self ) -> & Self :: Target {
112- & self . 0
113- }
114- }
115-
116- impl utoipa:: ToSchema for StringUdpAddressHashableMap { }
117-
118- impl utoipa:: PartialSchema for StringUdpAddressHashableMap {
119- fn schema ( ) -> utoipa:: openapi:: RefOr < utoipa:: openapi:: schema:: Schema > {
120- utoipa:: openapi:: ObjectBuilder :: new ( )
121- . additional_properties ( Some ( protocol:: RunnerAddressUdp :: schema ( ) ) )
122- . into ( )
123- }
124- }
0 commit comments