* Add ForwardParticipant method to RoomService * faked rpc client * generated protobuf --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
255 lines
13 KiB
Go
255 lines
13 KiB
Go
// Code generated by protoc-gen-psrpc v0.6.0, 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 livekit1 "github.com/livekit/protocol/livekit"
|
|
import livekit6 "github.com/livekit/protocol/livekit"
|
|
|
|
var _ = version.PsrpcVersion_0_6
|
|
|
|
// ============================
|
|
// Participant Client Interface
|
|
// ============================
|
|
|
|
type ParticipantClient[ParticipantTopicType ~string] interface {
|
|
RemoveParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit6.RoomParticipantIdentity, opts ...psrpc.RequestOption) (*livekit6.RemoveParticipantResponse, error)
|
|
|
|
MutePublishedTrack(ctx context.Context, participant ParticipantTopicType, req *livekit6.MuteRoomTrackRequest, opts ...psrpc.RequestOption) (*livekit6.MuteRoomTrackResponse, error)
|
|
|
|
UpdateParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit6.UpdateParticipantRequest, opts ...psrpc.RequestOption) (*livekit1.ParticipantInfo, error)
|
|
|
|
UpdateSubscriptions(ctx context.Context, participant ParticipantTopicType, req *livekit6.UpdateSubscriptionsRequest, opts ...psrpc.RequestOption) (*livekit6.UpdateSubscriptionsResponse, error)
|
|
|
|
ForwardParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit6.ForwardParticipantRequest, opts ...psrpc.RequestOption) (*livekit6.ForwardParticipantResponse, error)
|
|
|
|
// Close immediately, without waiting for pending RPCs
|
|
Close()
|
|
}
|
|
|
|
// ================================
|
|
// Participant ServerImpl Interface
|
|
// ================================
|
|
|
|
type ParticipantServerImpl interface {
|
|
RemoveParticipant(context.Context, *livekit6.RoomParticipantIdentity) (*livekit6.RemoveParticipantResponse, error)
|
|
|
|
MutePublishedTrack(context.Context, *livekit6.MuteRoomTrackRequest) (*livekit6.MuteRoomTrackResponse, error)
|
|
|
|
UpdateParticipant(context.Context, *livekit6.UpdateParticipantRequest) (*livekit1.ParticipantInfo, error)
|
|
|
|
UpdateSubscriptions(context.Context, *livekit6.UpdateSubscriptionsRequest) (*livekit6.UpdateSubscriptionsResponse, error)
|
|
|
|
ForwardParticipant(context.Context, *livekit6.ForwardParticipantRequest) (*livekit6.ForwardParticipantResponse, 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)
|
|
RegisterForwardParticipantTopic(participant ParticipantTopicType) error
|
|
DeregisterForwardParticipantTopic(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)
|
|
sd.RegisterMethod("ForwardParticipant", 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 *livekit6.RoomParticipantIdentity, opts ...psrpc.RequestOption) (*livekit6.RemoveParticipantResponse, error) {
|
|
return client.RequestSingle[*livekit6.RemoveParticipantResponse](ctx, c.client, "RemoveParticipant", []string{string(participant)}, req, opts...)
|
|
}
|
|
|
|
func (c *participantClient[ParticipantTopicType]) MutePublishedTrack(ctx context.Context, participant ParticipantTopicType, req *livekit6.MuteRoomTrackRequest, opts ...psrpc.RequestOption) (*livekit6.MuteRoomTrackResponse, error) {
|
|
return client.RequestSingle[*livekit6.MuteRoomTrackResponse](ctx, c.client, "MutePublishedTrack", []string{string(participant)}, req, opts...)
|
|
}
|
|
|
|
func (c *participantClient[ParticipantTopicType]) UpdateParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit6.UpdateParticipantRequest, opts ...psrpc.RequestOption) (*livekit1.ParticipantInfo, error) {
|
|
return client.RequestSingle[*livekit1.ParticipantInfo](ctx, c.client, "UpdateParticipant", []string{string(participant)}, req, opts...)
|
|
}
|
|
|
|
func (c *participantClient[ParticipantTopicType]) UpdateSubscriptions(ctx context.Context, participant ParticipantTopicType, req *livekit6.UpdateSubscriptionsRequest, opts ...psrpc.RequestOption) (*livekit6.UpdateSubscriptionsResponse, error) {
|
|
return client.RequestSingle[*livekit6.UpdateSubscriptionsResponse](ctx, c.client, "UpdateSubscriptions", []string{string(participant)}, req, opts...)
|
|
}
|
|
|
|
func (c *participantClient[ParticipantTopicType]) ForwardParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit6.ForwardParticipantRequest, opts ...psrpc.RequestOption) (*livekit6.ForwardParticipantResponse, error) {
|
|
return client.RequestSingle[*livekit6.ForwardParticipantResponse](ctx, c.client, "ForwardParticipant", []string{string(participant)}, req, opts...)
|
|
}
|
|
|
|
func (s *participantClient[ParticipantTopicType]) Close() {
|
|
s.client.Close()
|
|
}
|
|
|
|
// ==================
|
|
// 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)
|
|
sd.RegisterMethod("ForwardParticipant", 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]) RegisterForwardParticipantTopic(participant ParticipantTopicType) error {
|
|
return server.RegisterHandler(s.rpc, "ForwardParticipant", []string{string(participant)}, s.svc.ForwardParticipant, nil)
|
|
}
|
|
|
|
func (s *participantServer[ParticipantTopicType]) DeregisterForwardParticipantTopic(participant ParticipantTopicType) {
|
|
s.rpc.DeregisterHandler("ForwardParticipant", []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),
|
|
server.NewRegisterer(s.RegisterForwardParticipantTopic, s.DeregisterForwardParticipantTopic),
|
|
}
|
|
}
|
|
|
|
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 psrpcFileDescriptor6 = []byte{
|
|
// 316 bytes of a gzipped FileDescriptorProto
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0xcb, 0x4a, 0xc3, 0x40,
|
|
0x14, 0x25, 0x88, 0x2e, 0xa6, 0x08, 0x76, 0x54, 0x28, 0xc1, 0x47, 0x5f, 0xeb, 0x04, 0xf4, 0x0f,
|
|
0x5c, 0x08, 0x2e, 0x84, 0x12, 0x75, 0xe3, 0x46, 0x92, 0xc9, 0xd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