github.com/livekit/protocol@v1.39.3/rpc/rest_signal.psrpc.go (about) 1 // Code generated by protoc-gen-psrpc v0.6.0, DO NOT EDIT. 2 // source: rpc/rest_signal.proto 3 4 package rpc 5 6 import ( 7 "context" 8 9 "github.com/livekit/psrpc" 10 "github.com/livekit/psrpc/pkg/client" 11 "github.com/livekit/psrpc/pkg/info" 12 "github.com/livekit/psrpc/pkg/rand" 13 "github.com/livekit/psrpc/pkg/server" 14 "github.com/livekit/psrpc/version" 15 ) 16 import google_protobuf "google.golang.org/protobuf/types/known/emptypb" 17 18 var _ = version.PsrpcVersion_0_6 19 20 // ======================== 21 // RTCRest Client Interface 22 // ======================== 23 24 type RTCRestClient[TopicTopicType ~string] interface { 25 Create(ctx context.Context, topic TopicTopicType, req *RTCRestCreateRequest, opts ...psrpc.RequestOption) (*RTCRestCreateResponse, error) 26 27 // Close immediately, without waiting for pending RPCs 28 Close() 29 } 30 31 // ============================ 32 // RTCRest ServerImpl Interface 33 // ============================ 34 35 type RTCRestServerImpl interface { 36 Create(context.Context, *RTCRestCreateRequest) (*RTCRestCreateResponse, error) 37 } 38 39 // ======================== 40 // RTCRest Server Interface 41 // ======================== 42 43 type RTCRestServer[TopicTopicType ~string] interface { 44 RegisterCreateTopic(topic TopicTopicType) error 45 DeregisterCreateTopic(topic TopicTopicType) 46 RegisterAllCommonTopics(topic TopicTopicType) error 47 DeregisterAllCommonTopics(topic TopicTopicType) 48 49 // Close and wait for pending RPCs to complete 50 Shutdown() 51 52 // Close immediately, without waiting for pending RPCs 53 Kill() 54 } 55 56 // ============== 57 // RTCRest Client 58 // ============== 59 60 type rTCRestClient[TopicTopicType ~string] struct { 61 client *client.RPCClient 62 } 63 64 // NewRTCRestClient creates a psrpc client that implements the RTCRestClient interface. 65 func NewRTCRestClient[TopicTopicType ~string](bus psrpc.MessageBus, opts ...psrpc.ClientOption) (RTCRestClient[TopicTopicType], error) { 66 sd := &info.ServiceDefinition{ 67 Name: "RTCRest", 68 ID: rand.NewClientID(), 69 } 70 71 sd.RegisterMethod("Create", false, false, true, true) 72 73 rpcClient, err := client.NewRPCClient(sd, bus, opts...) 74 if err != nil { 75 return nil, err 76 } 77 78 return &rTCRestClient[TopicTopicType]{ 79 client: rpcClient, 80 }, nil 81 } 82 83 func (c *rTCRestClient[TopicTopicType]) Create(ctx context.Context, topic TopicTopicType, req *RTCRestCreateRequest, opts ...psrpc.RequestOption) (*RTCRestCreateResponse, error) { 84 return client.RequestSingle[*RTCRestCreateResponse](ctx, c.client, "Create", []string{string(topic)}, req, opts...) 85 } 86 87 func (s *rTCRestClient[TopicTopicType]) Close() { 88 s.client.Close() 89 } 90 91 // ============== 92 // RTCRest Server 93 // ============== 94 95 type rTCRestServer[TopicTopicType ~string] struct { 96 svc RTCRestServerImpl 97 rpc *server.RPCServer 98 } 99 100 // NewRTCRestServer builds a RPCServer that will route requests 101 // to the corresponding method in the provided svc implementation. 102 func NewRTCRestServer[TopicTopicType ~string](svc RTCRestServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (RTCRestServer[TopicTopicType], error) { 103 sd := &info.ServiceDefinition{ 104 Name: "RTCRest", 105 ID: rand.NewServerID(), 106 } 107 108 s := server.NewRPCServer(sd, bus, opts...) 109 110 sd.RegisterMethod("Create", false, false, true, true) 111 return &rTCRestServer[TopicTopicType]{ 112 svc: svc, 113 rpc: s, 114 }, nil 115 } 116 117 func (s *rTCRestServer[TopicTopicType]) RegisterCreateTopic(topic TopicTopicType) error { 118 return server.RegisterHandler(s.rpc, "Create", []string{string(topic)}, s.svc.Create, nil) 119 } 120 121 func (s *rTCRestServer[TopicTopicType]) DeregisterCreateTopic(topic TopicTopicType) { 122 s.rpc.DeregisterHandler("Create", []string{string(topic)}) 123 } 124 125 func (s *rTCRestServer[TopicTopicType]) allCommonTopicRegisterers() server.RegistererSlice { 126 return server.RegistererSlice{ 127 server.NewRegisterer(s.RegisterCreateTopic, s.DeregisterCreateTopic), 128 } 129 } 130 131 func (s *rTCRestServer[TopicTopicType]) RegisterAllCommonTopics(topic TopicTopicType) error { 132 return s.allCommonTopicRegisterers().Register(topic) 133 } 134 135 func (s *rTCRestServer[TopicTopicType]) DeregisterAllCommonTopics(topic TopicTopicType) { 136 s.allCommonTopicRegisterers().Deregister(topic) 137 } 138 139 func (s *rTCRestServer[TopicTopicType]) Shutdown() { 140 s.rpc.Close(false) 141 } 142 143 func (s *rTCRestServer[TopicTopicType]) Kill() { 144 s.rpc.Close(true) 145 } 146 147 // =================================== 148 // RTCRestParticipant Client Interface 149 // =================================== 150 151 type RTCRestParticipantClient[TopicTopicType ~string] interface { 152 ICETrickle(ctx context.Context, topic TopicTopicType, req *RTCRestParticipantICETrickleRequest, opts ...psrpc.RequestOption) (*google_protobuf.Empty, error) 153 154 ICERestart(ctx context.Context, topic TopicTopicType, req *RTCRestParticipantICERestartRequest, opts ...psrpc.RequestOption) (*RTCRestParticipantICERestartResponse, error) 155 156 DeleteSession(ctx context.Context, topic TopicTopicType, req *RTCRestParticipantDeleteSessionRequest, opts ...psrpc.RequestOption) (*google_protobuf.Empty, error) 157 158 // Close immediately, without waiting for pending RPCs 159 Close() 160 } 161 162 // ======================================= 163 // RTCRestParticipant ServerImpl Interface 164 // ======================================= 165 166 type RTCRestParticipantServerImpl interface { 167 ICETrickle(context.Context, *RTCRestParticipantICETrickleRequest) (*google_protobuf.Empty, error) 168 169 ICERestart(context.Context, *RTCRestParticipantICERestartRequest) (*RTCRestParticipantICERestartResponse, error) 170 171 DeleteSession(context.Context, *RTCRestParticipantDeleteSessionRequest) (*google_protobuf.Empty, error) 172 } 173 174 // =================================== 175 // RTCRestParticipant Server Interface 176 // =================================== 177 178 type RTCRestParticipantServer[TopicTopicType ~string] interface { 179 RegisterICETrickleTopic(topic TopicTopicType) error 180 DeregisterICETrickleTopic(topic TopicTopicType) 181 RegisterICERestartTopic(topic TopicTopicType) error 182 DeregisterICERestartTopic(topic TopicTopicType) 183 RegisterDeleteSessionTopic(topic TopicTopicType) error 184 DeregisterDeleteSessionTopic(topic TopicTopicType) 185 RegisterAllCommonTopics(topic TopicTopicType) error 186 DeregisterAllCommonTopics(topic TopicTopicType) 187 188 // Close and wait for pending RPCs to complete 189 Shutdown() 190 191 // Close immediately, without waiting for pending RPCs 192 Kill() 193 } 194 195 // ========================= 196 // RTCRestParticipant Client 197 // ========================= 198 199 type rTCRestParticipantClient[TopicTopicType ~string] struct { 200 client *client.RPCClient 201 } 202 203 // NewRTCRestParticipantClient creates a psrpc client that implements the RTCRestParticipantClient interface. 204 func NewRTCRestParticipantClient[TopicTopicType ~string](bus psrpc.MessageBus, opts ...psrpc.ClientOption) (RTCRestParticipantClient[TopicTopicType], error) { 205 sd := &info.ServiceDefinition{ 206 Name: "RTCRestParticipant", 207 ID: rand.NewClientID(), 208 } 209 210 sd.RegisterMethod("ICETrickle", false, false, true, true) 211 sd.RegisterMethod("ICERestart", false, false, true, true) 212 sd.RegisterMethod("DeleteSession", false, false, true, true) 213 214 rpcClient, err := client.NewRPCClient(sd, bus, opts...) 215 if err != nil { 216 return nil, err 217 } 218 219 return &rTCRestParticipantClient[TopicTopicType]{ 220 client: rpcClient, 221 }, nil 222 } 223 224 func (c *rTCRestParticipantClient[TopicTopicType]) ICETrickle(ctx context.Context, topic TopicTopicType, req *RTCRestParticipantICETrickleRequest, opts ...psrpc.RequestOption) (*google_protobuf.Empty, error) { 225 return client.RequestSingle[*google_protobuf.Empty](ctx, c.client, "ICETrickle", []string{string(topic)}, req, opts...) 226 } 227 228 func (c *rTCRestParticipantClient[TopicTopicType]) ICERestart(ctx context.Context, topic TopicTopicType, req *RTCRestParticipantICERestartRequest, opts ...psrpc.RequestOption) (*RTCRestParticipantICERestartResponse, error) { 229 return client.RequestSingle[*RTCRestParticipantICERestartResponse](ctx, c.client, "ICERestart", []string{string(topic)}, req, opts...) 230 } 231 232 func (c *rTCRestParticipantClient[TopicTopicType]) DeleteSession(ctx context.Context, topic TopicTopicType, req *RTCRestParticipantDeleteSessionRequest, opts ...psrpc.RequestOption) (*google_protobuf.Empty, error) { 233 return client.RequestSingle[*google_protobuf.Empty](ctx, c.client, "DeleteSession", []string{string(topic)}, req, opts...) 234 } 235 236 func (s *rTCRestParticipantClient[TopicTopicType]) Close() { 237 s.client.Close() 238 } 239 240 // ========================= 241 // RTCRestParticipant Server 242 // ========================= 243 244 type rTCRestParticipantServer[TopicTopicType ~string] struct { 245 svc RTCRestParticipantServerImpl 246 rpc *server.RPCServer 247 } 248 249 // NewRTCRestParticipantServer builds a RPCServer that will route requests 250 // to the corresponding method in the provided svc implementation. 251 func NewRTCRestParticipantServer[TopicTopicType ~string](svc RTCRestParticipantServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (RTCRestParticipantServer[TopicTopicType], error) { 252 sd := &info.ServiceDefinition{ 253 Name: "RTCRestParticipant", 254 ID: rand.NewServerID(), 255 } 256 257 s := server.NewRPCServer(sd, bus, opts...) 258 259 sd.RegisterMethod("ICETrickle", false, false, true, true) 260 sd.RegisterMethod("ICERestart", false, false, true, true) 261 sd.RegisterMethod("DeleteSession", false, false, true, true) 262 return &rTCRestParticipantServer[TopicTopicType]{ 263 svc: svc, 264 rpc: s, 265 }, nil 266 } 267 268 func (s *rTCRestParticipantServer[TopicTopicType]) RegisterICETrickleTopic(topic TopicTopicType) error { 269 return server.RegisterHandler(s.rpc, "ICETrickle", []string{string(topic)}, s.svc.ICETrickle, nil) 270 } 271 272 func (s *rTCRestParticipantServer[TopicTopicType]) DeregisterICETrickleTopic(topic TopicTopicType) { 273 s.rpc.DeregisterHandler("ICETrickle", []string{string(topic)}) 274 } 275 276 func (s *rTCRestParticipantServer[TopicTopicType]) RegisterICERestartTopic(topic TopicTopicType) error { 277 return server.RegisterHandler(s.rpc, "ICERestart", []string{string(topic)}, s.svc.ICERestart, nil) 278 } 279 280 func (s *rTCRestParticipantServer[TopicTopicType]) DeregisterICERestartTopic(topic TopicTopicType) { 281 s.rpc.DeregisterHandler("ICERestart", []string{string(topic)}) 282 } 283 284 func (s *rTCRestParticipantServer[TopicTopicType]) RegisterDeleteSessionTopic(topic TopicTopicType) error { 285 return server.RegisterHandler(s.rpc, "DeleteSession", []string{string(topic)}, s.svc.DeleteSession, nil) 286 } 287 288 func (s *rTCRestParticipantServer[TopicTopicType]) DeregisterDeleteSessionTopic(topic TopicTopicType) { 289 s.rpc.DeregisterHandler("DeleteSession", []string{string(topic)}) 290 } 291 292 func (s *rTCRestParticipantServer[TopicTopicType]) allCommonTopicRegisterers() server.RegistererSlice { 293 return server.RegistererSlice{ 294 server.NewRegisterer(s.RegisterICETrickleTopic, s.DeregisterICETrickleTopic), 295 server.NewRegisterer(s.RegisterICERestartTopic, s.DeregisterICERestartTopic), 296 server.NewRegisterer(s.RegisterDeleteSessionTopic, s.DeregisterDeleteSessionTopic), 297 } 298 } 299 300 func (s *rTCRestParticipantServer[TopicTopicType]) RegisterAllCommonTopics(topic TopicTopicType) error { 301 return s.allCommonTopicRegisterers().Register(topic) 302 } 303 304 func (s *rTCRestParticipantServer[TopicTopicType]) DeregisterAllCommonTopics(topic TopicTopicType) { 305 s.allCommonTopicRegisterers().Deregister(topic) 306 } 307 308 func (s *rTCRestParticipantServer[TopicTopicType]) Shutdown() { 309 s.rpc.Close(false) 310 } 311 312 func (s *rTCRestParticipantServer[TopicTopicType]) Kill() { 313 s.rpc.Close(true) 314 } 315 316 var psrpcFileDescriptor10 = []byte{ 317 // 690 bytes of a gzipped FileDescriptorProto 318 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x4d, 0x6f, 0xd3, 0x3e, 319 0x1c, 0x96, 0xdb, 0x6d, 0xff, 0x7f, 0x7f, 0x5d, 0xa7, 0xcd, 0xac, 0xa3, 0x4b, 0x35, 0xad, 0xeb, 320 0x06, 0x2a, 0x02, 0xa5, 0xa2, 0xbb, 0x8c, 0x1d, 0x29, 0x45, 0xaa, 0x84, 0x10, 0x4a, 0x77, 0x42, 321 0x48, 0x51, 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, 0xba, 0xd4, 0x77, 0x85, 0x27, 0x35, 0x23, 0x4c, 0x78, 0x91, 333 0x76, 0xb5, 0xf4, 0xc8, 0x40, 0x95, 0xb2, 0x95, 0x6c, 0x2d, 0xdf, 0x38, 0xb7, 0xa5, 0x20, 0xf6, 334 0x22, 0x6a, 0x76, 0x67, 0x52, 0xfe, 0xee, 0xa6, 0xfa, 0xc2, 0x14, 0xb7, 0x22, 0x2d, 0x47, 0x4e, 335 0x59, 0x2d, 0xcf, 0xb0, 0x9e, 0x41, 0xce, 0xac, 0xde, 0x30, 0xa5, 0xf1, 0x21, 0xe4, 0xcd, 0x54, 336 0x37, 0xf2, 0x42, 0xaa, 0x4a, 0xa8, 0x92, 0xad, 0xe5, 0x1c, 0x30, 0xd0, 0xdb, 0x18, 0xb1, 0x14, 337 0x54, 0xfe, 0x36, 0x0e, 0x6f, 0x43, 0x76, 0x40, 0x47, 0xc6, 0xa0, 0x9c, 0x13, 0x2f, 0xf1, 0x0b, 338 0x58, 0xbf, 0xf4, 0x82, 0x21, 0x35, 0xe2, 0xf3, 0x8d, 0xe3, 0xe5, 0x5a, 0x26, 0x54, 0x9c, 0xa4, 339 0xe2, 0x3c, 0x73, 0x86, 0xaa, 0x3f, 0x11, 0x14, 0x6f, 0x65, 0x2b, 0xc1, 0x23, 0x45, 0xf1, 0x01, 340 0x80, 0x17, 0xa9, 0xcf, 0xa9, 0xb5, 0xc9, 0xc4, 0x5c, 0x82, 0xc4, 0xde, 0x3e, 0x82, 0xad, 0x69, 341 0x43, 0x99, 0x9f, 0xba, 0x5f, 0x98, 0x42, 0xdb, 0x3e, 0x3e, 0x85, 0x3c, 0x23, 0xd4, 0x55, 0x54, 342 0x5e, 0x52, 0x39, 0x36, 0x1c, 0x4f, 0x76, 0xb6, 0xdd, 0x6c, 0x75, 0x4c, 0xc8, 0x01, 0x46, 0x68, 343 0xb2, 0x54, 0xf8, 0x04, 0xb6, 0x92, 0x22, 0xb3, 0xc7, 0x71, 0xef, 0x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xd3, 355 0xdd, 0x57, 0xdd, 0x18, 0x6b, 0xcf, 0x4e, 0x5e, 0x00, 0x7b, 0xfc, 0x02, 0xd8, 0xad, 0xf8, 0x05, 356 0xa8, 0xee, 0x5f, 0x5f, 0xa1, 0xe2, 0x42, 0x0e, 0xf8, 0x8b, 0x19, 0x95, 0x6e, 0xf1, 0xaa, 0x51, 357 0xb3, 0xa7, 0xd7, 0x7a, 0x72, 0x87, 0xcc, 0xd4, 0x81, 0x15, 0xd3, 0x39, 0x14, 0x66, 0xb6, 0x1b, 358 0x3f, 0x5d, 0xd2, 0x76, 0xd1, 0xa1, 0xf8, 0x07, 0xb9, 0x2f, 0x8f, 0xde, 0x1f, 0xf6, 0x99, 0xfe, 359 0x38, 0xec, 0xda, 0x84, 0x87, 0xf5, 0xf4, 0x6f, 0x96, 0x3c, 0x98, 0x84, 0x07, 0x75, 0x29, 0x48, 360 0x77, 0xc3, 0x7c, 0x9d, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x85, 0x92, 0x8e, 0x6a, 0x07, 361 0x00, 0x00, 362 }