update psrpc (#1312)

This commit is contained in:
David Colburn
2023-01-18 13:52:03 -08:00
committed by GitHub
parent edc39da0b1
commit e31b25300d
5 changed files with 88 additions and 82 deletions
+33 -31
View File
@@ -1,22 +1,24 @@
// Code generated by protoc-gen-psrpc v0.2.3, DO NOT EDIT.
// Code generated by protoc-gen-psrpc v0.2.4, DO NOT EDIT.
// source: pkg/service/rpc/egress.proto
package rpc
import context "context"
import psrpc1 "github.com/livekit/psrpc"
import psrpc "github.com/livekit/psrpc"
import version "github.com/livekit/psrpc/version"
import livekit "github.com/livekit/protocol/livekit"
import livekit3 "github.com/livekit/protocol/livekit"
var _ = version.PsrpcVersion_0_2_4
// ===============================
// EgressInternal Client Interface
// ===============================
type EgressInternalClient interface {
StartEgress(context.Context, *livekit3.StartEgressRequest, ...psrpc1.RequestOption) (*livekit.EgressInfo, error)
StartEgress(context.Context, *livekit3.StartEgressRequest, ...psrpc.RequestOption) (*livekit.EgressInfo, error)
ListActiveEgress(context.Context, *ListActiveEgressRequest, ...psrpc1.RequestOption) (<-chan *psrpc1.Response[*ListActiveEgressResponse], error)
ListActiveEgress(context.Context, *ListActiveEgressRequest, ...psrpc.RequestOption) (<-chan *psrpc.Response[*ListActiveEgressResponse], error)
}
// ===================================
@@ -47,12 +49,12 @@ type EgressInternalServer interface {
// =====================
type egressInternalClient struct {
client *psrpc1.RPCClient
client *psrpc.RPCClient
}
// NewEgressInternalClient creates a psrpc client that implements the EgressInternalClient interface.
func NewEgressInternalClient(clientID string, bus psrpc1.MessageBus, opts ...psrpc1.ClientOption) (EgressInternalClient, error) {
rpcClient, err := psrpc1.NewRPCClient("EgressInternal", clientID, bus, opts...)
func NewEgressInternalClient(clientID string, bus psrpc.MessageBus, opts ...psrpc.ClientOption) (EgressInternalClient, error) {
rpcClient, err := psrpc.NewRPCClient("EgressInternal", clientID, bus, opts...)
if err != nil {
return nil, err
}
@@ -62,12 +64,12 @@ func NewEgressInternalClient(clientID string, bus psrpc1.MessageBus, opts ...psr
}, nil
}
func (c *egressInternalClient) StartEgress(ctx context.Context, req *livekit3.StartEgressRequest, opts ...psrpc1.RequestOption) (*livekit.EgressInfo, error) {
return psrpc1.RequestSingle[*livekit.EgressInfo](ctx, c.client, "StartEgress", "", req, opts...)
func (c *egressInternalClient) StartEgress(ctx context.Context, req *livekit3.StartEgressRequest, opts ...psrpc.RequestOption) (*livekit.EgressInfo, error) {
return psrpc.RequestSingle[*livekit.EgressInfo](ctx, c.client, "StartEgress", "", req, opts...)
}
func (c *egressInternalClient) ListActiveEgress(ctx context.Context, req *ListActiveEgressRequest, opts ...psrpc1.RequestOption) (<-chan *psrpc1.Response[*ListActiveEgressResponse], error) {
return psrpc1.RequestMulti[*ListActiveEgressResponse](ctx, c.client, "ListActiveEgress", "", req, opts...)
func (c *egressInternalClient) ListActiveEgress(ctx context.Context, req *ListActiveEgressRequest, opts ...psrpc.RequestOption) (<-chan *psrpc.Response[*ListActiveEgressResponse], error) {
return psrpc.RequestMulti[*ListActiveEgressResponse](ctx, c.client, "ListActiveEgress", "", req, opts...)
}
// =====================
@@ -76,22 +78,22 @@ func (c *egressInternalClient) ListActiveEgress(ctx context.Context, req *ListAc
type egressInternalServer struct {
svc EgressInternalServerImpl
rpc *psrpc1.RPCServer
rpc *psrpc.RPCServer
}
// NewEgressInternalServer builds a RPCServer that will route requests
// to the corresponding method in the provided svc implementation.
func NewEgressInternalServer(serverID string, svc EgressInternalServerImpl, bus psrpc1.MessageBus, opts ...psrpc1.ServerOption) (EgressInternalServer, error) {
s := psrpc1.NewRPCServer("EgressInternal", serverID, bus, opts...)
func NewEgressInternalServer(serverID string, svc EgressInternalServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (EgressInternalServer, error) {
s := psrpc.NewRPCServer("EgressInternal", serverID, bus, opts...)
var err error
err = psrpc1.RegisterHandler(s, "StartEgress", "", svc.StartEgress, svc.StartEgressAffinity)
err = psrpc.RegisterHandler(s, "StartEgress", "", svc.StartEgress, svc.StartEgressAffinity)
if err != nil {
s.Close(false)
return nil, err
}
err = psrpc1.RegisterHandler(s, "ListActiveEgress", "", svc.ListActiveEgress, nil)
err = psrpc.RegisterHandler(s, "ListActiveEgress", "", svc.ListActiveEgress, nil)
if err != nil {
s.Close(false)
return nil, err
@@ -116,9 +118,9 @@ func (s *egressInternalServer) Kill() {
// ==============================
type EgressHandlerClient interface {
UpdateStream(context.Context, string, *livekit.UpdateStreamRequest, ...psrpc1.RequestOption) (*livekit.EgressInfo, error)
UpdateStream(context.Context, string, *livekit.UpdateStreamRequest, ...psrpc.RequestOption) (*livekit.EgressInfo, error)
StopEgress(context.Context, string, *livekit.StopEgressRequest, ...psrpc1.RequestOption) (*livekit.EgressInfo, error)
StopEgress(context.Context, string, *livekit.StopEgressRequest, ...psrpc.RequestOption) (*livekit.EgressInfo, error)
}
// ==================================
@@ -154,12 +156,12 @@ type EgressHandlerServer interface {
// ====================
type egressHandlerClient struct {
client *psrpc1.RPCClient
client *psrpc.RPCClient
}
// NewEgressHandlerClient creates a psrpc client that implements the EgressHandlerClient interface.
func NewEgressHandlerClient(clientID string, bus psrpc1.MessageBus, opts ...psrpc1.ClientOption) (EgressHandlerClient, error) {
rpcClient, err := psrpc1.NewRPCClient("EgressHandler", clientID, bus, opts...)
func NewEgressHandlerClient(clientID string, bus psrpc.MessageBus, opts ...psrpc.ClientOption) (EgressHandlerClient, error) {
rpcClient, err := psrpc.NewRPCClient("EgressHandler", clientID, bus, opts...)
if err != nil {
return nil, err
}
@@ -169,12 +171,12 @@ func NewEgressHandlerClient(clientID string, bus psrpc1.MessageBus, opts ...psrp
}, nil
}
func (c *egressHandlerClient) UpdateStream(ctx context.Context, topic string, req *livekit.UpdateStreamRequest, opts ...psrpc1.RequestOption) (*livekit.EgressInfo, error) {
return psrpc1.RequestSingle[*livekit.EgressInfo](ctx, c.client, "UpdateStream", topic, req, opts...)
func (c *egressHandlerClient) UpdateStream(ctx context.Context, topic string, req *livekit.UpdateStreamRequest, opts ...psrpc.RequestOption) (*livekit.EgressInfo, error) {
return psrpc.RequestSingle[*livekit.EgressInfo](ctx, c.client, "UpdateStream", topic, req, opts...)
}
func (c *egressHandlerClient) StopEgress(ctx context.Context, topic string, req *livekit.StopEgressRequest, opts ...psrpc1.RequestOption) (*livekit.EgressInfo, error) {
return psrpc1.RequestSingle[*livekit.EgressInfo](ctx, c.client, "StopEgress", topic, req, opts...)
func (c *egressHandlerClient) StopEgress(ctx context.Context, topic string, req *livekit.StopEgressRequest, opts ...psrpc.RequestOption) (*livekit.EgressInfo, error) {
return psrpc.RequestSingle[*livekit.EgressInfo](ctx, c.client, "StopEgress", topic, req, opts...)
}
// ====================
@@ -183,13 +185,13 @@ func (c *egressHandlerClient) StopEgress(ctx context.Context, topic string, req
type egressHandlerServer struct {
svc EgressHandlerServerImpl
rpc *psrpc1.RPCServer
rpc *psrpc.RPCServer
}
// NewEgressHandlerServer builds a RPCServer that will route requests
// to the corresponding method in the provided svc implementation.
func NewEgressHandlerServer(serverID string, svc EgressHandlerServerImpl, bus psrpc1.MessageBus, opts ...psrpc1.ServerOption) (EgressHandlerServer, error) {
s := psrpc1.NewRPCServer("EgressHandler", serverID, bus, opts...)
func NewEgressHandlerServer(serverID string, svc EgressHandlerServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (EgressHandlerServer, error) {
s := psrpc.NewRPCServer("EgressHandler", serverID, bus, opts...)
return &egressHandlerServer{
svc: svc,
@@ -198,7 +200,7 @@ func NewEgressHandlerServer(serverID string, svc EgressHandlerServerImpl, bus ps
}
func (s *egressHandlerServer) RegisterUpdateStreamTopic(topic string) error {
return psrpc1.RegisterHandler(s.rpc, "UpdateStream", topic, s.svc.UpdateStream, nil)
return psrpc.RegisterHandler(s.rpc, "UpdateStream", topic, s.svc.UpdateStream, nil)
}
func (s *egressHandlerServer) DeregisterUpdateStreamTopic(topic string) {
@@ -206,7 +208,7 @@ func (s *egressHandlerServer) DeregisterUpdateStreamTopic(topic string) {
}
func (s *egressHandlerServer) RegisterStopEgressTopic(topic string) error {
return psrpc1.RegisterHandler(s.rpc, "StopEgress", topic, s.svc.StopEgress, nil)
return psrpc.RegisterHandler(s.rpc, "StopEgress", topic, s.svc.StopEgress, nil)
}
func (s *egressHandlerServer) DeregisterStopEgressTopic(topic string) {