github.com/livekit/protocol@v1.16.1-0.20240517185851-47e4c6bba773/rpc/ingress.psrpc.go (about) 1 // Code generated by protoc-gen-psrpc v0.5.1, DO NOT EDIT. 2 // source: rpc/ingress.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 import livekit3 "github.com/livekit/protocol/livekit" 18 19 var _ = version.PsrpcVersion_0_5 20 21 // ================================ 22 // IngressInternal Client Interface 23 // ================================ 24 25 type IngressInternalClient interface { 26 StartIngress(ctx context.Context, req *StartIngressRequest, opts ...psrpc.RequestOption) (*livekit3.IngressInfo, error) 27 28 ListActiveIngress(ctx context.Context, topic string, req *ListActiveIngressRequest, opts ...psrpc.RequestOption) (<-chan *psrpc.Response[*ListActiveIngressResponse], error) 29 } 30 31 // ==================================== 32 // IngressInternal ServerImpl Interface 33 // ==================================== 34 35 type IngressInternalServerImpl interface { 36 StartIngress(context.Context, *StartIngressRequest) (*livekit3.IngressInfo, error) 37 StartIngressAffinity(context.Context, *StartIngressRequest) float32 38 39 ListActiveIngress(context.Context, *ListActiveIngressRequest) (*ListActiveIngressResponse, error) 40 } 41 42 // ================================ 43 // IngressInternal Server Interface 44 // ================================ 45 46 type IngressInternalServer interface { 47 RegisterListActiveIngressTopic(topic string) error 48 DeregisterListActiveIngressTopic(topic string) 49 50 // Close and wait for pending RPCs to complete 51 Shutdown() 52 53 // Close immediately, without waiting for pending RPCs 54 Kill() 55 } 56 57 // ====================== 58 // IngressInternal Client 59 // ====================== 60 61 type ingressInternalClient struct { 62 client *client.RPCClient 63 } 64 65 // NewIngressInternalClient creates a psrpc client that implements the IngressInternalClient interface. 66 func NewIngressInternalClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (IngressInternalClient, error) { 67 sd := &info.ServiceDefinition{ 68 Name: "IngressInternal", 69 ID: rand.NewClientID(), 70 } 71 72 sd.RegisterMethod("StartIngress", true, false, true, false) 73 sd.RegisterMethod("ListActiveIngress", false, true, false, false) 74 75 rpcClient, err := client.NewRPCClient(sd, bus, opts...) 76 if err != nil { 77 return nil, err 78 } 79 80 return &ingressInternalClient{ 81 client: rpcClient, 82 }, nil 83 } 84 85 func (c *ingressInternalClient) StartIngress(ctx context.Context, req *StartIngressRequest, opts ...psrpc.RequestOption) (*livekit3.IngressInfo, error) { 86 return client.RequestSingle[*livekit3.IngressInfo](ctx, c.client, "StartIngress", nil, req, opts...) 87 } 88 89 func (c *ingressInternalClient) ListActiveIngress(ctx context.Context, topic string, req *ListActiveIngressRequest, opts ...psrpc.RequestOption) (<-chan *psrpc.Response[*ListActiveIngressResponse], error) { 90 return client.RequestMulti[*ListActiveIngressResponse](ctx, c.client, "ListActiveIngress", []string{topic}, req, opts...) 91 } 92 93 // ====================== 94 // IngressInternal Server 95 // ====================== 96 97 type ingressInternalServer struct { 98 svc IngressInternalServerImpl 99 rpc *server.RPCServer 100 } 101 102 // NewIngressInternalServer builds a RPCServer that will route requests 103 // to the corresponding method in the provided svc implementation. 104 func NewIngressInternalServer(svc IngressInternalServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (IngressInternalServer, error) { 105 sd := &info.ServiceDefinition{ 106 Name: "IngressInternal", 107 ID: rand.NewServerID(), 108 } 109 110 s := server.NewRPCServer(sd, bus, opts...) 111 112 sd.RegisterMethod("StartIngress", true, false, true, false) 113 var err error 114 err = server.RegisterHandler(s, "StartIngress", nil, svc.StartIngress, svc.StartIngressAffinity) 115 if err != nil { 116 s.Close(false) 117 return nil, err 118 } 119 120 sd.RegisterMethod("ListActiveIngress", false, true, false, false) 121 return &ingressInternalServer{ 122 svc: svc, 123 rpc: s, 124 }, nil 125 } 126 127 func (s *ingressInternalServer) RegisterListActiveIngressTopic(topic string) error { 128 return server.RegisterHandler(s.rpc, "ListActiveIngress", []string{topic}, s.svc.ListActiveIngress, nil) 129 } 130 131 func (s *ingressInternalServer) DeregisterListActiveIngressTopic(topic string) { 132 s.rpc.DeregisterHandler("ListActiveIngress", []string{topic}) 133 } 134 135 func (s *ingressInternalServer) Shutdown() { 136 s.rpc.Close(false) 137 } 138 139 func (s *ingressInternalServer) Kill() { 140 s.rpc.Close(true) 141 } 142 143 // =============================== 144 // IngressHandler Client Interface 145 // =============================== 146 147 type IngressHandlerClient interface { 148 UpdateIngress(ctx context.Context, topic string, req *livekit3.UpdateIngressRequest, opts ...psrpc.RequestOption) (*livekit3.IngressState, error) 149 150 DeleteIngress(ctx context.Context, topic string, req *livekit3.DeleteIngressRequest, opts ...psrpc.RequestOption) (*livekit3.IngressState, error) 151 152 DeleteWHIPResource(ctx context.Context, topic string, req *DeleteWHIPResourceRequest, opts ...psrpc.RequestOption) (*google_protobuf.Empty, error) 153 154 ICERestartWHIPResource(ctx context.Context, topic string, req *ICERestartWHIPResourceRequest, opts ...psrpc.RequestOption) (*ICERestartWHIPResourceResponse, error) 155 } 156 157 // =================================== 158 // IngressHandler ServerImpl Interface 159 // =================================== 160 161 type IngressHandlerServerImpl interface { 162 UpdateIngress(context.Context, *livekit3.UpdateIngressRequest) (*livekit3.IngressState, error) 163 164 DeleteIngress(context.Context, *livekit3.DeleteIngressRequest) (*livekit3.IngressState, error) 165 166 DeleteWHIPResource(context.Context, *DeleteWHIPResourceRequest) (*google_protobuf.Empty, error) 167 168 ICERestartWHIPResource(context.Context, *ICERestartWHIPResourceRequest) (*ICERestartWHIPResourceResponse, error) 169 } 170 171 // =============================== 172 // IngressHandler Server Interface 173 // =============================== 174 175 type IngressHandlerServer interface { 176 RegisterUpdateIngressTopic(topic string) error 177 DeregisterUpdateIngressTopic(topic string) 178 RegisterDeleteIngressTopic(topic string) error 179 DeregisterDeleteIngressTopic(topic string) 180 RegisterDeleteWHIPResourceTopic(topic string) error 181 DeregisterDeleteWHIPResourceTopic(topic string) 182 RegisterICERestartWHIPResourceTopic(topic string) error 183 DeregisterICERestartWHIPResourceTopic(topic string) 184 185 // Close and wait for pending RPCs to complete 186 Shutdown() 187 188 // Close immediately, without waiting for pending RPCs 189 Kill() 190 } 191 192 // ===================== 193 // IngressHandler Client 194 // ===================== 195 196 type ingressHandlerClient struct { 197 client *client.RPCClient 198 } 199 200 // NewIngressHandlerClient creates a psrpc client that implements the IngressHandlerClient interface. 201 func NewIngressHandlerClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (IngressHandlerClient, error) { 202 sd := &info.ServiceDefinition{ 203 Name: "IngressHandler", 204 ID: rand.NewClientID(), 205 } 206 207 sd.RegisterMethod("UpdateIngress", false, false, true, true) 208 sd.RegisterMethod("DeleteIngress", false, false, true, true) 209 sd.RegisterMethod("DeleteWHIPResource", false, false, true, true) 210 sd.RegisterMethod("ICERestartWHIPResource", false, false, true, true) 211 212 rpcClient, err := client.NewRPCClient(sd, bus, opts...) 213 if err != nil { 214 return nil, err 215 } 216 217 return &ingressHandlerClient{ 218 client: rpcClient, 219 }, nil 220 } 221 222 func (c *ingressHandlerClient) UpdateIngress(ctx context.Context, topic string, req *livekit3.UpdateIngressRequest, opts ...psrpc.RequestOption) (*livekit3.IngressState, error) { 223 return client.RequestSingle[*livekit3.IngressState](ctx, c.client, "UpdateIngress", []string{topic}, req, opts...) 224 } 225 226 func (c *ingressHandlerClient) DeleteIngress(ctx context.Context, topic string, req *livekit3.DeleteIngressRequest, opts ...psrpc.RequestOption) (*livekit3.IngressState, error) { 227 return client.RequestSingle[*livekit3.IngressState](ctx, c.client, "DeleteIngress", []string{topic}, req, opts...) 228 } 229 230 func (c *ingressHandlerClient) DeleteWHIPResource(ctx context.Context, topic string, req *DeleteWHIPResourceRequest, opts ...psrpc.RequestOption) (*google_protobuf.Empty, error) { 231 return client.RequestSingle[*google_protobuf.Empty](ctx, c.client, "DeleteWHIPResource", []string{topic}, req, opts...) 232 } 233 234 func (c *ingressHandlerClient) ICERestartWHIPResource(ctx context.Context, topic string, req *ICERestartWHIPResourceRequest, opts ...psrpc.RequestOption) (*ICERestartWHIPResourceResponse, error) { 235 return client.RequestSingle[*ICERestartWHIPResourceResponse](ctx, c.client, "ICERestartWHIPResource", []string{topic}, req, opts...) 236 } 237 238 // ===================== 239 // IngressHandler Server 240 // ===================== 241 242 type ingressHandlerServer struct { 243 svc IngressHandlerServerImpl 244 rpc *server.RPCServer 245 } 246 247 // NewIngressHandlerServer builds a RPCServer that will route requests 248 // to the corresponding method in the provided svc implementation. 249 func NewIngressHandlerServer(svc IngressHandlerServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (IngressHandlerServer, error) { 250 sd := &info.ServiceDefinition{ 251 Name: "IngressHandler", 252 ID: rand.NewServerID(), 253 } 254 255 s := server.NewRPCServer(sd, bus, opts...) 256 257 sd.RegisterMethod("UpdateIngress", false, false, true, true) 258 sd.RegisterMethod("DeleteIngress", false, false, true, true) 259 sd.RegisterMethod("DeleteWHIPResource", false, false, true, true) 260 sd.RegisterMethod("ICERestartWHIPResource", false, false, true, true) 261 return &ingressHandlerServer{ 262 svc: svc, 263 rpc: s, 264 }, nil 265 } 266 267 func (s *ingressHandlerServer) RegisterUpdateIngressTopic(topic string) error { 268 return server.RegisterHandler(s.rpc, "UpdateIngress", []string{topic}, s.svc.UpdateIngress, nil) 269 } 270 271 func (s *ingressHandlerServer) DeregisterUpdateIngressTopic(topic string) { 272 s.rpc.DeregisterHandler("UpdateIngress", []string{topic}) 273 } 274 275 func (s *ingressHandlerServer) RegisterDeleteIngressTopic(topic string) error { 276 return server.RegisterHandler(s.rpc, "DeleteIngress", []string{topic}, s.svc.DeleteIngress, nil) 277 } 278 279 func (s *ingressHandlerServer) DeregisterDeleteIngressTopic(topic string) { 280 s.rpc.DeregisterHandler("DeleteIngress", []string{topic}) 281 } 282 283 func (s *ingressHandlerServer) RegisterDeleteWHIPResourceTopic(topic string) error { 284 return server.RegisterHandler(s.rpc, "DeleteWHIPResource", []string{topic}, s.svc.DeleteWHIPResource, nil) 285 } 286 287 func (s *ingressHandlerServer) DeregisterDeleteWHIPResourceTopic(topic string) { 288 s.rpc.DeregisterHandler("DeleteWHIPResource", []string{topic}) 289 } 290 291 func (s *ingressHandlerServer) RegisterICERestartWHIPResourceTopic(topic string) error { 292 return server.RegisterHandler(s.rpc, "ICERestartWHIPResource", []string{topic}, s.svc.ICERestartWHIPResource, nil) 293 } 294 295 func (s *ingressHandlerServer) DeregisterICERestartWHIPResourceTopic(topic string) { 296 s.rpc.DeregisterHandler("ICERestartWHIPResource", []string{topic}) 297 } 298 299 func (s *ingressHandlerServer) Shutdown() { 300 s.rpc.Close(false) 301 } 302 303 func (s *ingressHandlerServer) Kill() { 304 s.rpc.Close(true) 305 } 306 307 var psrpcFileDescriptor2 = []byte{ 308 // 637 bytes of a gzipped FileDescriptorProto 309 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcb, 0x4e, 0xdb, 0x40, 310 0x14, 0xd5, 0x24, 0x21, 0x82, 0x0b, 0xa1, 0x30, 0x3c, 0x64, 0x5c, 0xf1, 0xa8, 0xd9, 0x44, 0xaa, 311 0xe4, 0x54, 0xe9, 0xa6, 0xaa, 0xba, 0xa0, 0x0f, 0x10, 0x56, 0xa9, 0x84, 0x4c, 0x51, 0xa5, 0x56, 312 0xaa, 0x65, 0xec, 0x1b, 0x77, 0x14, 0xc7, 0xe3, 0xce, 0x8c, 0x41, 0xd9, 0x76, 0xc7, 0xef, 0xb0, 313 0xed, 0xa6, 0x7f, 0xd4, 0x5f, 0xa8, 0xec, 0x99, 0x00, 0x69, 0x12, 0xd4, 0x4d, 0x77, 0xbe, 0xe7, 314 0x9c, 0x39, 0xf7, 0x31, 0xbe, 0x03, 0xab, 0x22, 0x8f, 0x3a, 0x2c, 0x4b, 0x04, 0x4a, 0xe9, 0xe6, 315 0x82, 0x2b, 0x4e, 0xeb, 0x22, 0x8f, 0xec, 0x16, 0xcf, 0x15, 0xe3, 0x99, 0xc1, 0xec, 0x8d, 0x94, 316 0x5d, 0x62, 0x9f, 0xa9, 0x60, 0x4c, 0x6a, 0x3f, 0x4e, 0x38, 0x4f, 0x52, 0xec, 0x54, 0xd1, 0x45, 317 0xd1, 0xeb, 0xe0, 0x20, 0x57, 0x43, 0x4d, 0x3a, 0x36, 0x58, 0x27, 0x4c, 0xaa, 0xd7, 0x91, 0x62, 318 0x97, 0xe8, 0xe9, 0x73, 0x3e, 0x7e, 0x2f, 0x50, 0x2a, 0xe7, 0x15, 0x6c, 0x4d, 0xe1, 0x64, 0xce, 319 0x33, 0x89, 0x74, 0x17, 0x16, 0x4d, 0x9a, 0x80, 0xc5, 0xd2, 0x22, 0x7b, 0xf5, 0xf6, 0x82, 0x0f, 320 0x06, 0xf2, 0x62, 0xe9, 0x7c, 0x81, 0xad, 0x77, 0x98, 0xa2, 0xc2, 0x4f, 0xc7, 0xde, 0xa9, 0x8f, 321 0x92, 0x17, 0x22, 0x42, 0x63, 0x5d, 0x9e, 0x16, 0x06, 0x0a, 0x58, 0x6c, 0x91, 0x3d, 0x52, 0x9e, 322 0x1e, 0x41, 0x5e, 0x4c, 0xb7, 0x01, 0xa4, 0x12, 0x18, 0x0e, 0x82, 0x3e, 0x0e, 0xad, 0x5a, 0xc5, 323 0x2f, 0x68, 0xe4, 0x3d, 0x0e, 0x9d, 0x5f, 0x04, 0xb6, 0xbd, 0xb7, 0x87, 0x3e, 0x4a, 0x15, 0x0a, 324 0xf5, 0x1f, 0x32, 0xd0, 0x7d, 0x68, 0x15, 0x12, 0x45, 0xd0, 0x13, 0x61, 0x32, 0xc0, 0x4c, 0x59, 325 0xf5, 0x4a, 0xb1, 0x54, 0x82, 0x47, 0x06, 0xa3, 0x36, 0xcc, 0xe7, 0xa1, 0x94, 0x57, 0x5c, 0xc4, 326 0x56, 0xa3, 0xe2, 0x6f, 0x63, 0xba, 0x03, 0x10, 0x85, 0x59, 0xcc, 0xe2, 0x50, 0xa1, 0xb4, 0xe6, 327 0xf4, 0x7c, 0xee, 0x10, 0xe7, 0x14, 0x76, 0x66, 0x75, 0x60, 0x46, 0xec, 0xc2, 0x9a, 0x12, 0x2c, 328 0xea, 0xa7, 0x18, 0xb0, 0x08, 0x03, 0x19, 0xe7, 0x65, 0x31, 0xa6, 0x95, 0x55, 0x43, 0x79, 0x11, 329 0x9e, 0x69, 0xc2, 0xf9, 0x51, 0x83, 0xb5, 0xb3, 0xd2, 0x6d, 0xfc, 0x1e, 0x69, 0x1b, 0x1a, 0x2c, 330 0xeb, 0xf1, 0xea, 0xe0, 0x62, 0x77, 0xdd, 0x35, 0xbf, 0x89, 0x6b, 0x64, 0x5e, 0xd6, 0xe3, 0x7e, 331 0xa5, 0xa0, 0xeb, 0x30, 0xa7, 0x78, 0x1f, 0x33, 0x33, 0x0e, 0x1d, 0xd0, 0x0d, 0x68, 0x5e, 0xc9, 332 0xa0, 0x10, 0xa9, 0x99, 0xc1, 0xdc, 0x95, 0x3c, 0x17, 0x29, 0xf5, 0x61, 0x39, 0xe5, 0x49, 0xc2, 333 0xb2, 0x24, 0xe8, 0x31, 0x4c, 0x63, 0x69, 0x35, 0xf6, 0xea, 0xed, 0xc5, 0xee, 0x53, 0x57, 0xe4, 334 0x91, 0x3b, 0xa5, 0x10, 0xf7, 0x44, 0xcb, 0x8f, 0x2a, 0xf5, 0x61, 0xa6, 0xc4, 0xd0, 0x6f, 0xa5, 335 0xf7, 0x31, 0xfb, 0x00, 0xe8, 0xa4, 0x88, 0xae, 0x40, 0xbd, 0xbc, 0x23, 0xdd, 0x78, 0xf9, 0x59, 336 0x16, 0x7a, 0x19, 0xa6, 0x05, 0x8e, 0x0a, 0xad, 0x82, 0x97, 0xb5, 0x17, 0xa4, 0xfb, 0x93, 0xc0, 337 0xa3, 0xdb, 0xc6, 0x14, 0x8a, 0x2c, 0x4c, 0xe9, 0x31, 0x2c, 0xdd, 0x2f, 0x87,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