Files
protocol/rpc/signal.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

146 lines
5.3 KiB
Go

// Code generated by protoc-gen-psrpc v0.5.1, DO NOT EDIT.
// source: rpc/signal.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"
)
var _ = version.PsrpcVersion_0_5
// =======================
// Signal Client Interface
// =======================
type SignalClient[NodeIdTopicType ~string] interface {
RelaySignal(ctx context.Context, nodeId NodeIdTopicType, opts ...psrpc.RequestOption) (psrpc.ClientStream[*RelaySignalRequest, *RelaySignalResponse], error)
}
// ===========================
// Signal ServerImpl Interface
// ===========================
type SignalServerImpl interface {
RelaySignal(psrpc.ServerStream[*RelaySignalResponse, *RelaySignalRequest]) error
}
// =======================
// Signal Server Interface
// =======================
type SignalServer[NodeIdTopicType ~string] interface {
RegisterRelaySignalTopic(nodeId NodeIdTopicType) error
DeregisterRelaySignalTopic(nodeId NodeIdTopicType)
// Close and wait for pending RPCs to complete
Shutdown()
// Close immediately, without waiting for pending RPCs
Kill()
}
// =============
// Signal Client
// =============
type signalClient[NodeIdTopicType ~string] struct {
client *client.RPCClient
}
// NewSignalClient creates a psrpc client that implements the SignalClient interface.
func NewSignalClient[NodeIdTopicType ~string](bus psrpc.MessageBus, opts ...psrpc.ClientOption) (SignalClient[NodeIdTopicType], error) {
sd := &info.ServiceDefinition{
Name: "Signal",
ID: rand.NewClientID(),
}
sd.RegisterMethod("RelaySignal", false, false, false, true)
rpcClient, err := client.NewRPCClientWithStreams(sd, bus, opts...)
if err != nil {
return nil, err
}
return &signalClient[NodeIdTopicType]{
client: rpcClient,
}, nil
}
func (c *signalClient[NodeIdTopicType]) RelaySignal(ctx context.Context, nodeId NodeIdTopicType, opts ...psrpc.RequestOption) (psrpc.ClientStream[*RelaySignalRequest, *RelaySignalResponse], error) {
return client.OpenStream[*RelaySignalRequest, *RelaySignalResponse](ctx, c.client, "RelaySignal", []string{string(nodeId)}, opts...)
}
// =============
// Signal Server
// =============
type signalServer[NodeIdTopicType ~string] struct {
svc SignalServerImpl
rpc *server.RPCServer
}
// NewSignalServer builds a RPCServer that will route requests
// to the corresponding method in the provided svc implementation.
func NewSignalServer[NodeIdTopicType ~string](svc SignalServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (SignalServer[NodeIdTopicType], error) {
sd := &info.ServiceDefinition{
Name: "Signal",
ID: rand.NewServerID(),
}
s := server.NewRPCServer(sd, bus, opts...)
sd.RegisterMethod("RelaySignal", false, false, false, true)
return &signalServer[NodeIdTopicType]{
svc: svc,
rpc: s,
}, nil
}
func (s *signalServer[NodeIdTopicType]) RegisterRelaySignalTopic(nodeId NodeIdTopicType) error {
return server.RegisterStreamHandler(s.rpc, "RelaySignal", []string{string(nodeId)}, s.svc.RelaySignal, nil)
}
func (s *signalServer[NodeIdTopicType]) DeregisterRelaySignalTopic(nodeId NodeIdTopicType) {
s.rpc.DeregisterHandler("RelaySignal", []string{string(nodeId)})
}
func (s *signalServer[NodeIdTopicType]) Shutdown() {
s.rpc.Close(false)
}
func (s *signalServer[NodeIdTopicType]) Kill() {
s.rpc.Close(true)
}
var psrpcFileDescriptor7 = []byte{
// 307 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xb1, 0x4e, 0xc3, 0x30,
0x10, 0x86, 0x65, 0xd2, 0x96, 0xe2, 0x52, 0xa9, 0xb8, 0xd0, 0x5a, 0x59, 0x08, 0x9d, 0x32, 0x39,
0x52, 0x10, 0x0b, 0x23, 0x8f, 0xe0, 0x4e, 0xb0, 0x54, 0xa9, 0x6b, 0x15, 0x8b,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