// Code generated by protoc-gen-psrpc v0.6.0, 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_6 // ======================= // Signal Client Interface // ======================= type SignalClient[NodeIdTopicType ~string] interface { RelaySignal(ctx context.Context, nodeId NodeIdTopicType, opts ...psrpc.RequestOption) (psrpc.ClientStream[*RelaySignalRequest, *RelaySignalResponse], error) // Close immediately, without waiting for pending RPCs Close() } // =========================== // 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) RegisterAllNodeTopics(nodeId NodeIdTopicType) error DeregisterAllNodeTopics(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...) } func (s *signalClient[NodeIdTopicType]) Close() { s.client.Close() } // ============= // 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]) allNodeTopicRegisterers() server.RegistererSlice { return server.RegistererSlice{ server.NewRegisterer(s.RegisterRelaySignalTopic, s.DeregisterRelaySignalTopic), } } func (s *signalServer[NodeIdTopicType]) RegisterAllNodeTopics(nodeId NodeIdTopicType) error { return s.allNodeTopicRegisterers().Register(nodeId) } func (s *signalServer[NodeIdTopicType]) DeregisterAllNodeTopics(nodeId NodeIdTopicType) { s.allNodeTopicRegisterers().Deregister(nodeId) } func (s *signalServer[NodeIdTopicType]) Shutdown() { s.rpc.Close(false) } func (s *signalServer[NodeIdTopicType]) Kill() { s.rpc.Close(true) } var psrpcFileDescriptor9 = []byte{ // 313 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0x4f, 0x4e, 0xf3, 0x30, 0x10, 0xc5,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