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
+29 -27
View File
@@ -1,19 +1,21 @@
// 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/ingress.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 livekit2 "github.com/livekit/protocol/livekit"
var _ = version.PsrpcVersion_0_2_4
// ================================
// IngressInternal Client Interface
// ================================
type IngressInternalClient interface {
ListActiveIngress(context.Context, *ListActiveIngressRequest, ...psrpc1.RequestOption) (<-chan *psrpc1.Response[*ListActiveIngressResponse], error)
ListActiveIngress(context.Context, *ListActiveIngressRequest, ...psrpc.RequestOption) (<-chan *psrpc.Response[*ListActiveIngressResponse], error)
}
// ====================================
@@ -41,12 +43,12 @@ type IngressInternalServer interface {
// ======================
type ingressInternalClient struct {
client *psrpc1.RPCClient
client *psrpc.RPCClient
}
// NewIngressInternalClient creates a psrpc client that implements the IngressInternalClient interface.
func NewIngressInternalClient(clientID string, bus psrpc1.MessageBus, opts ...psrpc1.ClientOption) (IngressInternalClient, error) {
rpcClient, err := psrpc1.NewRPCClient("IngressInternal", clientID, bus, opts...)
func NewIngressInternalClient(clientID string, bus psrpc.MessageBus, opts ...psrpc.ClientOption) (IngressInternalClient, error) {
rpcClient, err := psrpc.NewRPCClient("IngressInternal", clientID, bus, opts...)
if err != nil {
return nil, err
}
@@ -56,8 +58,8 @@ func NewIngressInternalClient(clientID string, bus psrpc1.MessageBus, opts ...ps
}, nil
}
func (c *ingressInternalClient) ListActiveIngress(ctx context.Context, req *ListActiveIngressRequest, opts ...psrpc1.RequestOption) (<-chan *psrpc1.Response[*ListActiveIngressResponse], error) {
return psrpc1.RequestMulti[*ListActiveIngressResponse](ctx, c.client, "ListActiveIngress", "", req, opts...)
func (c *ingressInternalClient) ListActiveIngress(ctx context.Context, req *ListActiveIngressRequest, opts ...psrpc.RequestOption) (<-chan *psrpc.Response[*ListActiveIngressResponse], error) {
return psrpc.RequestMulti[*ListActiveIngressResponse](ctx, c.client, "ListActiveIngress", "", req, opts...)
}
// ======================
@@ -66,16 +68,16 @@ func (c *ingressInternalClient) ListActiveIngress(ctx context.Context, req *List
type ingressInternalServer struct {
svc IngressInternalServerImpl
rpc *psrpc1.RPCServer
rpc *psrpc.RPCServer
}
// NewIngressInternalServer builds a RPCServer that will route requests
// to the corresponding method in the provided svc implementation.
func NewIngressInternalServer(serverID string, svc IngressInternalServerImpl, bus psrpc1.MessageBus, opts ...psrpc1.ServerOption) (IngressInternalServer, error) {
s := psrpc1.NewRPCServer("IngressInternal", serverID, bus, opts...)
func NewIngressInternalServer(serverID string, svc IngressInternalServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (IngressInternalServer, error) {
s := psrpc.NewRPCServer("IngressInternal", serverID, bus, opts...)
var err error
err = psrpc1.RegisterHandler(s, "ListActiveIngress", "", svc.ListActiveIngress, nil)
err = psrpc.RegisterHandler(s, "ListActiveIngress", "", svc.ListActiveIngress, nil)
if err != nil {
s.Close(false)
return nil, err
@@ -100,9 +102,9 @@ func (s *ingressInternalServer) Kill() {
// ===============================
type IngressHandlerClient interface {
UpdateIngress(context.Context, string, *livekit2.UpdateIngressRequest, ...psrpc1.RequestOption) (*livekit2.IngressState, error)
UpdateIngress(context.Context, string, *livekit2.UpdateIngressRequest, ...psrpc.RequestOption) (*livekit2.IngressState, error)
DeleteIngress(context.Context, string, *livekit2.DeleteIngressRequest, ...psrpc1.RequestOption) (*livekit2.IngressState, error)
DeleteIngress(context.Context, string, *livekit2.DeleteIngressRequest, ...psrpc.RequestOption) (*livekit2.IngressState, error)
}
// ===================================
@@ -138,12 +140,12 @@ type IngressHandlerServer interface {
// =====================
type ingressHandlerClient struct {
client *psrpc1.RPCClient
client *psrpc.RPCClient
}
// NewIngressHandlerClient creates a psrpc client that implements the IngressHandlerClient interface.
func NewIngressHandlerClient(clientID string, bus psrpc1.MessageBus, opts ...psrpc1.ClientOption) (IngressHandlerClient, error) {
rpcClient, err := psrpc1.NewRPCClient("IngressHandler", clientID, bus, opts...)
func NewIngressHandlerClient(clientID string, bus psrpc.MessageBus, opts ...psrpc.ClientOption) (IngressHandlerClient, error) {
rpcClient, err := psrpc.NewRPCClient("IngressHandler", clientID, bus, opts...)
if err != nil {
return nil, err
}
@@ -153,12 +155,12 @@ func NewIngressHandlerClient(clientID string, bus psrpc1.MessageBus, opts ...psr
}, nil
}
func (c *ingressHandlerClient) UpdateIngress(ctx context.Context, topic string, req *livekit2.UpdateIngressRequest, opts ...psrpc1.RequestOption) (*livekit2.IngressState, error) {
return psrpc1.RequestSingle[*livekit2.IngressState](ctx, c.client, "UpdateIngress", topic, req, opts...)
func (c *ingressHandlerClient) UpdateIngress(ctx context.Context, topic string, req *livekit2.UpdateIngressRequest, opts ...psrpc.RequestOption) (*livekit2.IngressState, error) {
return psrpc.RequestSingle[*livekit2.IngressState](ctx, c.client, "UpdateIngress", topic, req, opts...)
}
func (c *ingressHandlerClient) DeleteIngress(ctx context.Context, topic string, req *livekit2.DeleteIngressRequest, opts ...psrpc1.RequestOption) (*livekit2.IngressState, error) {
return psrpc1.RequestSingle[*livekit2.IngressState](ctx, c.client, "DeleteIngress", topic, req, opts...)
func (c *ingressHandlerClient) DeleteIngress(ctx context.Context, topic string, req *livekit2.DeleteIngressRequest, opts ...psrpc.RequestOption) (*livekit2.IngressState, error) {
return psrpc.RequestSingle[*livekit2.IngressState](ctx, c.client, "DeleteIngress", topic, req, opts...)
}
// =====================
@@ -167,13 +169,13 @@ func (c *ingressHandlerClient) DeleteIngress(ctx context.Context, topic string,
type ingressHandlerServer struct {
svc IngressHandlerServerImpl
rpc *psrpc1.RPCServer
rpc *psrpc.RPCServer
}
// NewIngressHandlerServer builds a RPCServer that will route requests
// to the corresponding method in the provided svc implementation.
func NewIngressHandlerServer(serverID string, svc IngressHandlerServerImpl, bus psrpc1.MessageBus, opts ...psrpc1.ServerOption) (IngressHandlerServer, error) {
s := psrpc1.NewRPCServer("IngressHandler", serverID, bus, opts...)
func NewIngressHandlerServer(serverID string, svc IngressHandlerServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (IngressHandlerServer, error) {
s := psrpc.NewRPCServer("IngressHandler", serverID, bus, opts...)
return &ingressHandlerServer{
svc: svc,
@@ -182,7 +184,7 @@ func NewIngressHandlerServer(serverID string, svc IngressHandlerServerImpl, bus
}
func (s *ingressHandlerServer) RegisterUpdateIngressTopic(topic string) error {
return psrpc1.RegisterHandler(s.rpc, "UpdateIngress", topic, s.svc.UpdateIngress, nil)
return psrpc.RegisterHandler(s.rpc, "UpdateIngress", topic, s.svc.UpdateIngress, nil)
}
func (s *ingressHandlerServer) DeregisterUpdateIngressTopic(topic string) {
@@ -190,7 +192,7 @@ func (s *ingressHandlerServer) DeregisterUpdateIngressTopic(topic string) {
}
func (s *ingressHandlerServer) RegisterDeleteIngressTopic(topic string) error {
return psrpc1.RegisterHandler(s.rpc, "DeleteIngress", topic, s.svc.DeleteIngress, nil)
return psrpc.RegisterHandler(s.rpc, "DeleteIngress", topic, s.svc.DeleteIngress, nil)
}
func (s *ingressHandlerServer) DeregisterDeleteIngressTopic(topic string) {