github.com/livekit/protocol@v1.39.3/rpc/egress.psrpc.go (about) 1 // Code generated by protoc-gen-psrpc v0.6.0, DO NOT EDIT. 2 // source: rpc/egress.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 livekit4 "github.com/livekit/protocol/livekit" 17 18 var _ = version.PsrpcVersion_0_6 19 20 // =============================== 21 // EgressInternal Client Interface 22 // =============================== 23 24 type EgressInternalClient interface { 25 StartEgress(ctx context.Context, topic string, req *StartEgressRequest, opts ...psrpc.RequestOption) (*livekit4.EgressInfo, error) 26 27 ListActiveEgress(ctx context.Context, topic string, req *ListActiveEgressRequest, opts ...psrpc.RequestOption) (<-chan *psrpc.Response[*ListActiveEgressResponse], error) 28 29 // Close immediately, without waiting for pending RPCs 30 Close() 31 } 32 33 // =================================== 34 // EgressInternal ServerImpl Interface 35 // =================================== 36 37 type EgressInternalServerImpl interface { 38 StartEgress(context.Context, *StartEgressRequest) (*livekit4.EgressInfo, error) 39 StartEgressAffinity(context.Context, *StartEgressRequest) float32 40 41 ListActiveEgress(context.Context, *ListActiveEgressRequest) (*ListActiveEgressResponse, error) 42 } 43 44 // =============================== 45 // EgressInternal Server Interface 46 // =============================== 47 48 type EgressInternalServer interface { 49 RegisterStartEgressTopic(topic string) error 50 DeregisterStartEgressTopic(topic string) 51 RegisterListActiveEgressTopic(topic string) error 52 DeregisterListActiveEgressTopic(topic string) 53 54 // Close and wait for pending RPCs to complete 55 Shutdown() 56 57 // Close immediately, without waiting for pending RPCs 58 Kill() 59 } 60 61 // ===================== 62 // EgressInternal Client 63 // ===================== 64 65 type egressInternalClient struct { 66 client *client.RPCClient 67 } 68 69 // NewEgressInternalClient creates a psrpc client that implements the EgressInternalClient interface. 70 func NewEgressInternalClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (EgressInternalClient, error) { 71 sd := &info.ServiceDefinition{ 72 Name: "EgressInternal", 73 ID: rand.NewClientID(), 74 } 75 76 sd.RegisterMethod("StartEgress", true, false, true, false) 77 sd.RegisterMethod("ListActiveEgress", false, true, false, false) 78 79 rpcClient, err := client.NewRPCClient(sd, bus, opts...) 80 if err != nil { 81 return nil, err 82 } 83 84 return &egressInternalClient{ 85 client: rpcClient, 86 }, nil 87 } 88 89 func (c *egressInternalClient) StartEgress(ctx context.Context, topic string, req *StartEgressRequest, opts ...psrpc.RequestOption) (*livekit4.EgressInfo, error) { 90 return client.RequestSingle[*livekit4.EgressInfo](ctx, c.client, "StartEgress", []string{topic}, req, opts...) 91 } 92 93 func (c *egressInternalClient) ListActiveEgress(ctx context.Context, topic string, req *ListActiveEgressRequest, opts ...psrpc.RequestOption) (<-chan *psrpc.Response[*ListActiveEgressResponse], error) { 94 return client.RequestMulti[*ListActiveEgressResponse](ctx, c.client, "ListActiveEgress", []string{topic}, req, opts...) 95 } 96 97 func (s *egressInternalClient) Close() { 98 s.client.Close() 99 } 100 101 // ===================== 102 // EgressInternal Server 103 // ===================== 104 105 type egressInternalServer struct { 106 svc EgressInternalServerImpl 107 rpc *server.RPCServer 108 } 109 110 // NewEgressInternalServer builds a RPCServer that will route requests 111 // to the corresponding method in the provided svc implementation. 112 func NewEgressInternalServer(svc EgressInternalServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (EgressInternalServer, error) { 113 sd := &info.ServiceDefinition{ 114 Name: "EgressInternal", 115 ID: rand.NewServerID(), 116 } 117 118 s := server.NewRPCServer(sd, bus, opts...) 119 120 sd.RegisterMethod("StartEgress", true, false, true, false) 121 sd.RegisterMethod("ListActiveEgress", false, true, false, false) 122 return &egressInternalServer{ 123 svc: svc, 124 rpc: s, 125 }, nil 126 } 127 128 func (s *egressInternalServer) RegisterStartEgressTopic(topic string) error { 129 return server.RegisterHandler(s.rpc, "StartEgress", []string{topic}, s.svc.StartEgress, s.svc.StartEgressAffinity) 130 } 131 132 func (s *egressInternalServer) DeregisterStartEgressTopic(topic string) { 133 s.rpc.DeregisterHandler("StartEgress", []string{topic}) 134 } 135 136 func (s *egressInternalServer) RegisterListActiveEgressTopic(topic string) error { 137 return server.RegisterHandler(s.rpc, "ListActiveEgress", []string{topic}, s.svc.ListActiveEgress, nil) 138 } 139 140 func (s *egressInternalServer) DeregisterListActiveEgressTopic(topic string) { 141 s.rpc.DeregisterHandler("ListActiveEgress", []string{topic}) 142 } 143 144 func (s *egressInternalServer) Shutdown() { 145 s.rpc.Close(false) 146 } 147 148 func (s *egressInternalServer) Kill() { 149 s.rpc.Close(true) 150 } 151 152 // ============================== 153 // EgressHandler Client Interface 154 // ============================== 155 156 type EgressHandlerClient interface { 157 UpdateStream(ctx context.Context, topic string, req *livekit4.UpdateStreamRequest, opts ...psrpc.RequestOption) (*livekit4.EgressInfo, error) 158 159 StopEgress(ctx context.Context, topic string, req *livekit4.StopEgressRequest, opts ...psrpc.RequestOption) (*livekit4.EgressInfo, error) 160 161 // Close immediately, without waiting for pending RPCs 162 Close() 163 } 164 165 // ================================== 166 // EgressHandler ServerImpl Interface 167 // ================================== 168 169 type EgressHandlerServerImpl interface { 170 UpdateStream(context.Context, *livekit4.UpdateStreamRequest) (*livekit4.EgressInfo, error) 171 172 StopEgress(context.Context, *livekit4.StopEgressRequest) (*livekit4.EgressInfo, error) 173 } 174 175 // ============================== 176 // EgressHandler Server Interface 177 // ============================== 178 179 type EgressHandlerServer interface { 180 RegisterUpdateStreamTopic(topic string) error 181 DeregisterUpdateStreamTopic(topic string) 182 RegisterStopEgressTopic(topic string) error 183 DeregisterStopEgressTopic(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 // EgressHandler Client 194 // ==================== 195 196 type egressHandlerClient struct { 197 client *client.RPCClient 198 } 199 200 // NewEgressHandlerClient creates a psrpc client that implements the EgressHandlerClient interface. 201 func NewEgressHandlerClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (EgressHandlerClient, error) { 202 sd := &info.ServiceDefinition{ 203 Name: "EgressHandler", 204 ID: rand.NewClientID(), 205 } 206 207 sd.RegisterMethod("UpdateStream", false, false, true, true) 208 sd.RegisterMethod("StopEgress", false, false, true, true) 209 210 rpcClient, err := client.NewRPCClient(sd, bus, opts...) 211 if err != nil { 212 return nil, err 213 } 214 215 return &egressHandlerClient{ 216 client: rpcClient, 217 }, nil 218 } 219 220 func (c *egressHandlerClient) UpdateStream(ctx context.Context, topic string, req *livekit4.UpdateStreamRequest, opts ...psrpc.RequestOption) (*livekit4.EgressInfo, error) { 221 return client.RequestSingle[*livekit4.EgressInfo](ctx, c.client, "UpdateStream", []string{topic}, req, opts...) 222 } 223 224 func (c *egressHandlerClient) StopEgress(ctx context.Context, topic string, req *livekit4.StopEgressRequest, opts ...psrpc.RequestOption) (*livekit4.EgressInfo, error) { 225 return client.RequestSingle[*livekit4.EgressInfo](ctx, c.client, "StopEgress", []string{topic}, req, opts...) 226 } 227 228 func (s *egressHandlerClient) Close() { 229 s.client.Close() 230 } 231 232 // ==================== 233 // EgressHandler Server 234 // ==================== 235 236 type egressHandlerServer struct { 237 svc EgressHandlerServerImpl 238 rpc *server.RPCServer 239 } 240 241 // NewEgressHandlerServer builds a RPCServer that will route requests 242 // to the corresponding method in the provided svc implementation. 243 func NewEgressHandlerServer(svc EgressHandlerServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (EgressHandlerServer, error) { 244 sd := &info.ServiceDefinition{ 245 Name: "EgressHandler", 246 ID: rand.NewServerID(), 247 } 248 249 s := server.NewRPCServer(sd, bus, opts...) 250 251 sd.RegisterMethod("UpdateStream", false, false, true, true) 252 sd.RegisterMethod("StopEgress", false, false, true, true) 253 return &egressHandlerServer{ 254 svc: svc, 255 rpc: s, 256 }, nil 257 } 258 259 func (s *egressHandlerServer) RegisterUpdateStreamTopic(topic string) error { 260 return server.RegisterHandler(s.rpc, "UpdateStream", []string{topic}, s.svc.UpdateStream, nil) 261 } 262 263 func (s *egressHandlerServer) DeregisterUpdateStreamTopic(topic string) { 264 s.rpc.DeregisterHandler("UpdateStream", []string{topic}) 265 } 266 267 func (s *egressHandlerServer) RegisterStopEgressTopic(topic string) error { 268 return server.RegisterHandler(s.rpc, "StopEgress", []string{topic}, s.svc.StopEgress, nil) 269 } 270 271 func (s *egressHandlerServer) DeregisterStopEgressTopic(topic string) { 272 s.rpc.DeregisterHandler("StopEgress", []string{topic}) 273 } 274 275 func (s *egressHandlerServer) Shutdown() { 276 s.rpc.Close(false) 277 } 278 279 func (s *egressHandlerServer) Kill() { 280 s.rpc.Close(true) 281 } 282 283 var psrpcFileDescriptor2 = []byte{ 284 // 544 bytes of a gzipped FileDescriptorProto 285 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xd1, 0x4e, 0xdb, 0x3e, 286 0x14, 0xc6, 0xff, 0xa6, 0x7f, 0x02, 0x39, 0xa5, 0x5d, 0xe5, 0x31, 0x61, 0x0a, 0x68, 0xa5, 0xec, 287 0x22, 0x37, 0x4b, 0x11, 0x5c, 0xed, 0x6e, 0x03, 0x55, 0xa3, 0x12, 0xd2, 0xa6, 0x74, 0x68, 0xd2, 288 0x76, 0x11, 0x25, 0x8e, 0xc7, 0xac, 0x26, 0xb1, 0x67, 0x3b, 0xf4, 0x19, 0x78, 0x8c, 0x69, 0x6f, 289 0xc0, 0xc5, 0x9e, 0x6f, 0xaa, 0xd3, 0x86, 0xb4, 0xa8, 0xd3, 0x2e, 0xfd, 0x7d, 0xe7, 0xfb, 0xe5, 290 0x9c, 0xa3, 0x13, 0xe8, 0x28, 0x49, 0x07, 0xec, 0x56, 0x31, 0xad, 0x7d, 0xa9, 0x84, 0x11, 0xb8, 291 0xa1, 0x24, 0xed, 0xb6, 0x84, 0x34, 0x5c, 0x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07, 0x7e, 0x01, 0xce, 0x54, 303 0x87, 0x85, 0x4a, 0x89, 0x5b, 0xca, 0x53, 0x7d, 0xa3, 0x52, 0x7c, 0x0a, 0xbb, 0x34, 0x15, 0x45, 304 0x12, 0xc6, 0x11, 0x9d, 0x14, 0x32, 0x64, 0x79, 0x14, 0xa7, 0x2c, 0x21, 0xd0, 0x43, 0xde, 0x76, 305 0x80, 0xad, 0x77, 0x61, 0xad, 0x61, 0xe9, 0xe0, 0x13, 0x68, 0x31, 0x6d, 0x78, 0x16, 0x19, 0x96, 306 0x84, 0x54, 0x16, 0xa4, 0xdd, 0x43, 0x1e, 0x0a, 0x76, 0x2a, 0xf1, 0x52, 0x16, 0x17, 0x2e, 0x6c, 307 0xa9, 0xb2, 0xe1, 0xfe, 0x3e, 0xec, 0x5d, 0x73, 0x6d, 0xde, 0x51, 0xc3, 0xef, 0x96, 0x37, 0xd1, 308 0x7f, 0x03, 0xe4, 0xa9, 0xa5, 0xa5, 0xc8, 0x35, 0xc3, 0x47, 0x00, 0xd5, 0x15, 0x69, 0x82, 0x7a, 309 0x0d, 0xcf, 0x0d, 0xdc, 0xc5, 0x19, 0xe9, 0xb3, 0xdf, 0x08, 0xda, 0x65, 0x62, 0x94, 0x1b, 0xa6, 310 0xf2, 0x28, 0xc5, 0xef, 0xa1, 0x59, 0xbb, 0x46, 0xbc, 0xe7, 0x2b, 0x49, 0xfd, 0xa7, 0xf7, 0xd9, 311 0x7d, 0x5e, 0xad, 0x77, 0x01, 0xf8, 0x26, 0xfa, 0xf0, 0x70, 0x8f, 0x9c, 0x0e, 0x7a, 0x8b, 0x4e, 312 0x11, 0xfe, 0x0a, 0x9d, 0xd5, 0xb6, 0xf0, 0xa1, 0xa5, 0xad, 0x19, 0xa4, 0x7b, 0xb4, 0xc6, 0x2d, 313 0x67, 0xa9, 0xe0, 0x1b, 0x1e, 0x3a, 0xfb, 0x89, 0xa0, 0x55, 0xda, 0x57, 0x51, 0x9e, 0xa4, 0x4c, 314 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