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

226 lines
11 KiB
Go

// Code generated by protoc-gen-psrpc v0.5.1, DO NOT EDIT.
// source: rpc/participant.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 livekit "github.com/livekit/protocol/livekit"
import livekit4 "github.com/livekit/protocol/livekit"
var _ = version.PsrpcVersion_0_5
// ============================
// Participant Client Interface
// ============================
type ParticipantClient[ParticipantTopicType ~string] interface {
RemoveParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit4.RoomParticipantIdentity, opts ...psrpc.RequestOption) (*livekit4.RemoveParticipantResponse, error)
MutePublishedTrack(ctx context.Context, participant ParticipantTopicType, req *livekit4.MuteRoomTrackRequest, opts ...psrpc.RequestOption) (*livekit4.MuteRoomTrackResponse, error)
UpdateParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit4.UpdateParticipantRequest, opts ...psrpc.RequestOption) (*livekit.ParticipantInfo, error)
UpdateSubscriptions(ctx context.Context, participant ParticipantTopicType, req *livekit4.UpdateSubscriptionsRequest, opts ...psrpc.RequestOption) (*livekit4.UpdateSubscriptionsResponse, error)
}
// ================================
// Participant ServerImpl Interface
// ================================
type ParticipantServerImpl interface {
RemoveParticipant(context.Context, *livekit4.RoomParticipantIdentity) (*livekit4.RemoveParticipantResponse, error)
MutePublishedTrack(context.Context, *livekit4.MuteRoomTrackRequest) (*livekit4.MuteRoomTrackResponse, error)
UpdateParticipant(context.Context, *livekit4.UpdateParticipantRequest) (*livekit.ParticipantInfo, error)
UpdateSubscriptions(context.Context, *livekit4.UpdateSubscriptionsRequest) (*livekit4.UpdateSubscriptionsResponse, error)
}
// ============================
// Participant Server Interface
// ============================
type ParticipantServer[ParticipantTopicType ~string] interface {
RegisterRemoveParticipantTopic(participant ParticipantTopicType) error
DeregisterRemoveParticipantTopic(participant ParticipantTopicType)
RegisterMutePublishedTrackTopic(participant ParticipantTopicType) error
DeregisterMutePublishedTrackTopic(participant ParticipantTopicType)
RegisterUpdateParticipantTopic(participant ParticipantTopicType) error
DeregisterUpdateParticipantTopic(participant ParticipantTopicType)
RegisterUpdateSubscriptionsTopic(participant ParticipantTopicType) error
DeregisterUpdateSubscriptionsTopic(participant ParticipantTopicType)
RegisterAllParticipantTopics(participant ParticipantTopicType) error
DeregisterAllParticipantTopics(participant ParticipantTopicType)
// Close and wait for pending RPCs to complete
Shutdown()
// Close immediately, without waiting for pending RPCs
Kill()
}
// ==================
// Participant Client
// ==================
type participantClient[ParticipantTopicType ~string] struct {
client *client.RPCClient
}
// NewParticipantClient creates a psrpc client that implements the ParticipantClient interface.
func NewParticipantClient[ParticipantTopicType ~string](bus psrpc.MessageBus, opts ...psrpc.ClientOption) (ParticipantClient[ParticipantTopicType], error) {
sd := &info.ServiceDefinition{
Name: "Participant",
ID: rand.NewClientID(),
}
sd.RegisterMethod("RemoveParticipant", false, false, true, true)
sd.RegisterMethod("MutePublishedTrack", false, false, true, true)
sd.RegisterMethod("UpdateParticipant", false, false, true, true)
sd.RegisterMethod("UpdateSubscriptions", false, false, true, true)
rpcClient, err := client.NewRPCClient(sd, bus, opts...)
if err != nil {
return nil, err
}
return &participantClient[ParticipantTopicType]{
client: rpcClient,
}, nil
}
func (c *participantClient[ParticipantTopicType]) RemoveParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit4.RoomParticipantIdentity, opts ...psrpc.RequestOption) (*livekit4.RemoveParticipantResponse, error) {
return client.RequestSingle[*livekit4.RemoveParticipantResponse](ctx, c.client, "RemoveParticipant", []string{string(participant)}, req, opts...)
}
func (c *participantClient[ParticipantTopicType]) MutePublishedTrack(ctx context.Context, participant ParticipantTopicType, req *livekit4.MuteRoomTrackRequest, opts ...psrpc.RequestOption) (*livekit4.MuteRoomTrackResponse, error) {
return client.RequestSingle[*livekit4.MuteRoomTrackResponse](ctx, c.client, "MutePublishedTrack", []string{string(participant)}, req, opts...)
}
func (c *participantClient[ParticipantTopicType]) UpdateParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit4.UpdateParticipantRequest, opts ...psrpc.RequestOption) (*livekit.ParticipantInfo, error) {
return client.RequestSingle[*livekit.ParticipantInfo](ctx, c.client, "UpdateParticipant", []string{string(participant)}, req, opts...)
}
func (c *participantClient[ParticipantTopicType]) UpdateSubscriptions(ctx context.Context, participant ParticipantTopicType, req *livekit4.UpdateSubscriptionsRequest, opts ...psrpc.RequestOption) (*livekit4.UpdateSubscriptionsResponse, error) {
return client.RequestSingle[*livekit4.UpdateSubscriptionsResponse](ctx, c.client, "UpdateSubscriptions", []string{string(participant)}, req, opts...)
}
// ==================
// Participant Server
// ==================
type participantServer[ParticipantTopicType ~string] struct {
svc ParticipantServerImpl
rpc *server.RPCServer
}
// NewParticipantServer builds a RPCServer that will route requests
// to the corresponding method in the provided svc implementation.
func NewParticipantServer[ParticipantTopicType ~string](svc ParticipantServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (ParticipantServer[ParticipantTopicType], error) {
sd := &info.ServiceDefinition{
Name: "Participant",
ID: rand.NewServerID(),
}
s := server.NewRPCServer(sd, bus, opts...)
sd.RegisterMethod("RemoveParticipant", false, false, true, true)
sd.RegisterMethod("MutePublishedTrack", false, false, true, true)
sd.RegisterMethod("UpdateParticipant", false, false, true, true)
sd.RegisterMethod("UpdateSubscriptions", false, false, true, true)
return &participantServer[ParticipantTopicType]{
svc: svc,
rpc: s,
}, nil
}
func (s *participantServer[ParticipantTopicType]) RegisterRemoveParticipantTopic(participant ParticipantTopicType) error {
return server.RegisterHandler(s.rpc, "RemoveParticipant", []string{string(participant)}, s.svc.RemoveParticipant, nil)
}
func (s *participantServer[ParticipantTopicType]) DeregisterRemoveParticipantTopic(participant ParticipantTopicType) {
s.rpc.DeregisterHandler("RemoveParticipant", []string{string(participant)})
}
func (s *participantServer[ParticipantTopicType]) RegisterMutePublishedTrackTopic(participant ParticipantTopicType) error {
return server.RegisterHandler(s.rpc, "MutePublishedTrack", []string{string(participant)}, s.svc.MutePublishedTrack, nil)
}
func (s *participantServer[ParticipantTopicType]) DeregisterMutePublishedTrackTopic(participant ParticipantTopicType) {
s.rpc.DeregisterHandler("MutePublishedTrack", []string{string(participant)})
}
func (s *participantServer[ParticipantTopicType]) RegisterUpdateParticipantTopic(participant ParticipantTopicType) error {
return server.RegisterHandler(s.rpc, "UpdateParticipant", []string{string(participant)}, s.svc.UpdateParticipant, nil)
}
func (s *participantServer[ParticipantTopicType]) DeregisterUpdateParticipantTopic(participant ParticipantTopicType) {
s.rpc.DeregisterHandler("UpdateParticipant", []string{string(participant)})
}
func (s *participantServer[ParticipantTopicType]) RegisterUpdateSubscriptionsTopic(participant ParticipantTopicType) error {
return server.RegisterHandler(s.rpc, "UpdateSubscriptions", []string{string(participant)}, s.svc.UpdateSubscriptions, nil)
}
func (s *participantServer[ParticipantTopicType]) DeregisterUpdateSubscriptionsTopic(participant ParticipantTopicType) {
s.rpc.DeregisterHandler("UpdateSubscriptions", []string{string(participant)})
}
func (s *participantServer[ParticipantTopicType]) allParticipantTopicRegisterers() server.RegistererSlice {
return server.RegistererSlice{
server.NewRegisterer(s.RegisterRemoveParticipantTopic, s.DeregisterRemoveParticipantTopic),
server.NewRegisterer(s.RegisterMutePublishedTrackTopic, s.DeregisterMutePublishedTrackTopic),
server.NewRegisterer(s.RegisterUpdateParticipantTopic, s.DeregisterUpdateParticipantTopic),
server.NewRegisterer(s.RegisterUpdateSubscriptionsTopic, s.DeregisterUpdateSubscriptionsTopic),
}
}
func (s *participantServer[ParticipantTopicType]) RegisterAllParticipantTopics(participant ParticipantTopicType) error {
return s.allParticipantTopicRegisterers().Register(participant)
}
func (s *participantServer[ParticipantTopicType]) DeregisterAllParticipantTopics(participant ParticipantTopicType) {
s.allParticipantTopicRegisterers().Deregister(participant)
}
func (s *participantServer[ParticipantTopicType]) Shutdown() {
s.rpc.Close(false)
}
func (s *participantServer[ParticipantTopicType]) Kill() {
s.rpc.Close(true)
}
var psrpcFileDescriptor5 = []byte{
// 293 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xcf, 0x4a, 0xc3, 0x40,
0x10, 0xc6, 0x09, 0x8a, 0x87, 0x2d, 0x82, 0x5d, 0x15, 0x4a, 0xf0, 0x4f, 0x5b, 0x7b, 0x4e, 0x40,
0xdf, 0xc0, 0x9b, 0x07, 0xa1, 0x44, 0xbd, 0x78, 0x91, 0x64, 0x33, 0xda, 0xa5, 0xc9, 0xce, 0xba,
0x3b, 0x5b, 0xe8, 0xc9, 0x9b, 0xa0, 0x8f, 0xe3, 0x13, 0x4a, 0x93, 0x26, 0xdd, 0x56, 0x14, 0x7b,
0x9c, 0xdf, 0x37, 0xf3, 0x7d, 0x99, 0xc9, 0xb2, 0x63, 0xa3, 0x45, 0xac, 0x53, 0x43, 0x52, 0x48,
0x9d, 0x2a, 0x8a, 0xb4, 0x41, 0x42, 0xbe, 0x63, 0xb4, 0x08, 0xf7, 0x51, 0x93, 0x44, 0x65, 0x6b,
0x16, 0x1e, 0x15, 0x72, 0x06, 0x53, 0x49, 0x4f, 0x25, 0xe6, 0x50, 0x34, 0x94, 0x37, 0xd4, 0x20,
0x96, 0x35, 0xbb, 0xfc, 0xdc, 0x65, 0x9d, 0xf1, 0xca, 0x93, 0xbf, 0xb1, 0x6e, 0x02, 0x25, 0xce,
0xc0, 0x87, 0xfd, 0x68, 0x39, 0x19, 0x25, 0x88, 0xa5, 0xa7, 0xdc, 0xe4, 0xa0, 0x48, 0xd2, 0x3c,
0x1c, 0xae, 0x3a, 0x36, 0xa7, 0x13, 0xb0, 0x1a, 0x95, 0x85,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