Files
protocol/rpc/egress.psrpc.go
David Colburn e746785292 fix rpc package (#678)
* fix rpc package

* generated protobuf

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-04-11 14:27:17 -07:00

303 lines
11 KiB
Go

// Code generated by protoc-gen-psrpc v0.5.1, DO NOT EDIT.
// source: rpc/egress.proto
package rpc
import (
"context"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/pkg/client"
"github.com/livekit/psrpc/pkg/info"
"github.com/livekit/psrpc/pkg/rand"
"github.com/livekit/psrpc/pkg/server"
"github.com/livekit/psrpc/version"
)
import livekit2 "github.com/livekit/protocol/livekit"
var _ = version.PsrpcVersion_0_5
// ===============================
// EgressInternal Client Interface
// ===============================
type EgressInternalClient interface {
StartEgress(ctx context.Context, topic string, req *StartEgressRequest, opts ...psrpc.RequestOption) (*livekit2.EgressInfo, error)
ListActiveEgress(ctx context.Context, topic string, req *ListActiveEgressRequest, opts ...psrpc.RequestOption) (<-chan *psrpc.Response[*ListActiveEgressResponse], error)
}
// ===================================
// EgressInternal ServerImpl Interface
// ===================================
type EgressInternalServerImpl interface {
StartEgress(context.Context, *StartEgressRequest) (*livekit2.EgressInfo, error)
StartEgressAffinity(context.Context, *StartEgressRequest) float32
ListActiveEgress(context.Context, *ListActiveEgressRequest) (*ListActiveEgressResponse, error)
}
// ===============================
// EgressInternal Server Interface
// ===============================
type EgressInternalServer interface {
RegisterStartEgressTopic(topic string) error
DeregisterStartEgressTopic(topic string)
RegisterListActiveEgressTopic(topic string) error
DeregisterListActiveEgressTopic(topic string)
// Close and wait for pending RPCs to complete
Shutdown()
// Close immediately, without waiting for pending RPCs
Kill()
}
// =====================
// EgressInternal Client
// =====================
type egressInternalClient struct {
client *client.RPCClient
}
// NewEgressInternalClient creates a psrpc client that implements the EgressInternalClient interface.
func NewEgressInternalClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (EgressInternalClient, error) {
sd := &info.ServiceDefinition{
Name: "EgressInternal",
ID: rand.NewClientID(),
}
sd.RegisterMethod("StartEgress", true, false, true, false)
sd.RegisterMethod("ListActiveEgress", false, true, false, false)
rpcClient, err := client.NewRPCClient(sd, bus, opts...)
if err != nil {
return nil, err
}
return &egressInternalClient{
client: rpcClient,
}, nil
}
func (c *egressInternalClient) StartEgress(ctx context.Context, topic string, req *StartEgressRequest, opts ...psrpc.RequestOption) (*livekit2.EgressInfo, error) {
return client.RequestSingle[*livekit2.EgressInfo](ctx, c.client, "StartEgress", []string{topic}, req, opts...)
}
func (c *egressInternalClient) ListActiveEgress(ctx context.Context, topic string, req *ListActiveEgressRequest, opts ...psrpc.RequestOption) (<-chan *psrpc.Response[*ListActiveEgressResponse], error) {
return client.RequestMulti[*ListActiveEgressResponse](ctx, c.client, "ListActiveEgress", []string{topic}, req, opts...)
}
// =====================
// EgressInternal Server
// =====================
type egressInternalServer struct {
svc EgressInternalServerImpl
rpc *server.RPCServer
}
// NewEgressInternalServer builds a RPCServer that will route requests
// to the corresponding method in the provided svc implementation.
func NewEgressInternalServer(svc EgressInternalServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (EgressInternalServer, error) {
sd := &info.ServiceDefinition{
Name: "EgressInternal",
ID: rand.NewServerID(),
}
s := server.NewRPCServer(sd, bus, opts...)
sd.RegisterMethod("StartEgress", true, false, true, false)
sd.RegisterMethod("ListActiveEgress", false, true, false, false)
return &egressInternalServer{
svc: svc,
rpc: s,
}, nil
}
func (s *egressInternalServer) RegisterStartEgressTopic(topic string) error {
return server.RegisterHandler(s.rpc, "StartEgress", []string{topic}, s.svc.StartEgress, s.svc.StartEgressAffinity)
}
func (s *egressInternalServer) DeregisterStartEgressTopic(topic string) {
s.rpc.DeregisterHandler("StartEgress", []string{topic})
}
func (s *egressInternalServer) RegisterListActiveEgressTopic(topic string) error {
return server.RegisterHandler(s.rpc, "ListActiveEgress", []string{topic}, s.svc.ListActiveEgress, nil)
}
func (s *egressInternalServer) DeregisterListActiveEgressTopic(topic string) {
s.rpc.DeregisterHandler("ListActiveEgress", []string{topic})
}
func (s *egressInternalServer) Shutdown() {
s.rpc.Close(false)
}
func (s *egressInternalServer) Kill() {
s.rpc.Close(true)
}
// ==============================
// EgressHandler Client Interface
// ==============================
type EgressHandlerClient interface {
UpdateStream(ctx context.Context, topic string, req *livekit2.UpdateStreamRequest, opts ...psrpc.RequestOption) (*livekit2.EgressInfo, error)
StopEgress(ctx context.Context, topic string, req *livekit2.StopEgressRequest, opts ...psrpc.RequestOption) (*livekit2.EgressInfo, error)
}
// ==================================
// EgressHandler ServerImpl Interface
// ==================================
type EgressHandlerServerImpl interface {
UpdateStream(context.Context, *livekit2.UpdateStreamRequest) (*livekit2.EgressInfo, error)
StopEgress(context.Context, *livekit2.StopEgressRequest) (*livekit2.EgressInfo, error)
}
// ==============================
// EgressHandler Server Interface
// ==============================
type EgressHandlerServer interface {
RegisterUpdateStreamTopic(topic string) error
DeregisterUpdateStreamTopic(topic string)
RegisterStopEgressTopic(topic string) error
DeregisterStopEgressTopic(topic string)
// Close and wait for pending RPCs to complete
Shutdown()
// Close immediately, without waiting for pending RPCs
Kill()
}
// ====================
// EgressHandler Client
// ====================
type egressHandlerClient struct {
client *client.RPCClient
}
// NewEgressHandlerClient creates a psrpc client that implements the EgressHandlerClient interface.
func NewEgressHandlerClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (EgressHandlerClient, error) {
sd := &info.ServiceDefinition{
Name: "EgressHandler",
ID: rand.NewClientID(),
}
sd.RegisterMethod("UpdateStream", false, false, true, true)
sd.RegisterMethod("StopEgress", false, false, true, true)
rpcClient, err := client.NewRPCClient(sd, bus, opts...)
if err != nil {
return nil, err
}
return &egressHandlerClient{
client: rpcClient,
}, nil
}
func (c *egressHandlerClient) UpdateStream(ctx context.Context, topic string, req *livekit2.UpdateStreamRequest, opts ...psrpc.RequestOption) (*livekit2.EgressInfo, error) {
return client.RequestSingle[*livekit2.EgressInfo](ctx, c.client, "UpdateStream", []string{topic}, req, opts...)
}
func (c *egressHandlerClient) StopEgress(ctx context.Context, topic string, req *livekit2.StopEgressRequest, opts ...psrpc.RequestOption) (*livekit2.EgressInfo, error) {
return client.RequestSingle[*livekit2.EgressInfo](ctx, c.client, "StopEgress", []string{topic}, req, opts...)
}
// ====================
// EgressHandler Server
// ====================
type egressHandlerServer struct {
svc EgressHandlerServerImpl
rpc *server.RPCServer
}
// NewEgressHandlerServer builds a RPCServer that will route requests
// to the corresponding method in the provided svc implementation.
func NewEgressHandlerServer(svc EgressHandlerServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (EgressHandlerServer, error) {
sd := &info.ServiceDefinition{
Name: "EgressHandler",
ID: rand.NewServerID(),
}
s := server.NewRPCServer(sd, bus, opts...)
sd.RegisterMethod("UpdateStream", false, false, true, true)
sd.RegisterMethod("StopEgress", false, false, true, true)
return &egressHandlerServer{
svc: svc,
rpc: s,
}, nil
}
func (s *egressHandlerServer) RegisterUpdateStreamTopic(topic string) error {
return server.RegisterHandler(s.rpc, "UpdateStream", []string{topic}, s.svc.UpdateStream, nil)
}
func (s *egressHandlerServer) DeregisterUpdateStreamTopic(topic string) {
s.rpc.DeregisterHandler("UpdateStream", []string{topic})
}
func (s *egressHandlerServer) RegisterStopEgressTopic(topic string) error {
return server.RegisterHandler(s.rpc, "StopEgress", []string{topic}, s.svc.StopEgress, nil)
}
func (s *egressHandlerServer) DeregisterStopEgressTopic(topic string) {
s.rpc.DeregisterHandler("StopEgress", []string{topic})
}
func (s *egressHandlerServer) Shutdown() {
s.rpc.Close(false)
}
func (s *egressHandlerServer) Kill() {
s.rpc.Close(true)
}
var psrpcFileDescriptor1 = []byte{
// 491 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xd1, 0x6e, 0x12, 0x41,
0x14, 0x86, 0x9d, 0x12, 0x96, 0xee, 0x41, 0x90, 0x8c, 0x35, 0x4c, 0x69, 0x1b, 0x29,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