diff --git a/magefile.go b/magefile.go index 467b49ccd..327aa55b6 100644 --- a/magefile.go +++ b/magefile.go @@ -62,6 +62,7 @@ func Proto() error { "rpc/ingress.proto", "rpc/io.proto", "rpc/room.proto", + "rpc/participant.proto", "rpc/signal.proto", } diff --git a/rpc/egress.pb.go b/rpc/egress.pb.go index 4216ea73a..2eb36a9d3 100644 --- a/rpc/egress.pb.go +++ b/rpc/egress.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v3.21.12 +// protoc v4.23.4 // source: rpc/egress.proto package rpc diff --git a/rpc/ingress.pb.go b/rpc/ingress.pb.go index f453354dd..f00b198c3 100644 --- a/rpc/ingress.pb.go +++ b/rpc/ingress.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v3.21.12 +// protoc v4.23.4 // source: rpc/ingress.proto package rpc diff --git a/rpc/io.pb.go b/rpc/io.pb.go index d80f72fb5..4abc3f67c 100644 --- a/rpc/io.pb.go +++ b/rpc/io.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v3.21.12 +// protoc v4.23.4 // source: rpc/io.proto package rpc diff --git a/rpc/participant.pb.go b/rpc/participant.pb.go new file mode 100644 index 000000000..6c121e580 --- /dev/null +++ b/rpc/participant.pb.go @@ -0,0 +1,119 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.23.4 +// source: rpc/participant.proto + +package rpc + +import ( + livekit "github.com/livekit/protocol/livekit" + _ "github.com/livekit/psrpc/protoc-gen-psrpc/options" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +var File_rpc_participant_proto protoreflect.FileDescriptor + +var file_rpc_participant_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, + 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x72, 0x70, 0x63, 0x1a, 0x0d, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x6c, 0x69, 0x76, + 0x65, 0x6b, 0x69, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x12, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x6d, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x8a, 0x04, 0x0a, 0x0b, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, + 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x7f, 0x0a, 0x11, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x20, 0x2e, 0x6c, 0x69, 0x76, + 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, + 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x22, 0x2e, 0x6c, + 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x61, 0x72, + 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x24, 0xb2, 0x89, 0x01, 0x20, 0x10, 0x01, 0x1a, 0x1c, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x74, + 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, + 0x70, 0x61, 0x6e, 0x74, 0x18, 0x01, 0x12, 0x79, 0x0a, 0x12, 0x4d, 0x75, 0x74, 0x65, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, 0x1d, 0x2e, 0x6c, + 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x54, + 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6c, 0x69, + 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x54, 0x72, + 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0xb2, 0x89, 0x01, + 0x20, 0x10, 0x01, 0x1a, 0x1c, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, + 0x6e, 0x74, 0x12, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x18, + 0x01, 0x12, 0x76, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, + 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x21, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, + 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, + 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, + 0x6e, 0x66, 0x6f, 0x22, 0x24, 0xb2, 0x89, 0x01, 0x20, 0x10, 0x01, 0x1a, 0x1c, 0x0a, 0x0b, 0x70, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x0b, 0x70, 0x61, 0x72, 0x74, + 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x18, 0x01, 0x12, 0x86, 0x01, 0x0a, 0x13, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x23, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0xb2, 0x89, + 0x01, 0x20, 0x10, 0x01, 0x1a, 0x1c, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, + 0x61, 0x6e, 0x74, 0x12, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, + 0x18, 0x01, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, + 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x72, 0x70, 0x63, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_rpc_participant_proto_goTypes = []interface{}{ + (*livekit.RoomParticipantIdentity)(nil), // 0: livekit.RoomParticipantIdentity + (*livekit.MuteRoomTrackRequest)(nil), // 1: livekit.MuteRoomTrackRequest + (*livekit.UpdateParticipantRequest)(nil), // 2: livekit.UpdateParticipantRequest + (*livekit.UpdateSubscriptionsRequest)(nil), // 3: livekit.UpdateSubscriptionsRequest + (*livekit.RemoveParticipantResponse)(nil), // 4: livekit.RemoveParticipantResponse + (*livekit.MuteRoomTrackResponse)(nil), // 5: livekit.MuteRoomTrackResponse + (*livekit.ParticipantInfo)(nil), // 6: livekit.ParticipantInfo + (*livekit.UpdateSubscriptionsResponse)(nil), // 7: livekit.UpdateSubscriptionsResponse +} +var file_rpc_participant_proto_depIdxs = []int32{ + 0, // 0: rpc.Participant.RemoveParticipant:input_type -> livekit.RoomParticipantIdentity + 1, // 1: rpc.Participant.MutePublishedTrack:input_type -> livekit.MuteRoomTrackRequest + 2, // 2: rpc.Participant.UpdateParticipant:input_type -> livekit.UpdateParticipantRequest + 3, // 3: rpc.Participant.UpdateSubscriptions:input_type -> livekit.UpdateSubscriptionsRequest + 4, // 4: rpc.Participant.RemoveParticipant:output_type -> livekit.RemoveParticipantResponse + 5, // 5: rpc.Participant.MutePublishedTrack:output_type -> livekit.MuteRoomTrackResponse + 6, // 6: rpc.Participant.UpdateParticipant:output_type -> livekit.ParticipantInfo + 7, // 7: rpc.Participant.UpdateSubscriptions:output_type -> livekit.UpdateSubscriptionsResponse + 4, // [4:8] is the sub-list for method output_type + 0, // [0:4] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_rpc_participant_proto_init() } +func file_rpc_participant_proto_init() { + if File_rpc_participant_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_rpc_participant_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_rpc_participant_proto_goTypes, + DependencyIndexes: file_rpc_participant_proto_depIdxs, + }.Build() + File_rpc_participant_proto = out.File + file_rpc_participant_proto_rawDesc = nil + file_rpc_participant_proto_goTypes = nil + file_rpc_participant_proto_depIdxs = nil +} diff --git a/rpc/participant.proto b/rpc/participant.proto new file mode 100644 index 000000000..52371e357 --- /dev/null +++ b/rpc/participant.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; + +package rpc; + +option go_package = "github.com/livekit/livekit/pkg/service/rpc"; + +import "options.proto"; +import "livekit_models.proto"; +import "livekit_room.proto"; + +service Participant { + rpc RemoveParticipant(livekit.RoomParticipantIdentity) returns (livekit.RemoveParticipantResponse) { + option (psrpc.options) = { + topics: true + topic_params: { + group: "participant" + names: ["participant"] + typed: true + }; + }; + }; + rpc MutePublishedTrack(livekit.MuteRoomTrackRequest) returns (livekit.MuteRoomTrackResponse) { + option (psrpc.options) = { + topics: true + topic_params: { + group: "participant" + names: ["participant"] + typed: true + }; + }; + }; + rpc UpdateParticipant(livekit.UpdateParticipantRequest) returns (livekit.ParticipantInfo) { + option (psrpc.options) = { + topics: true + topic_params: { + group: "participant" + names: ["participant"] + typed: true + }; + }; + }; + rpc UpdateSubscriptions(livekit.UpdateSubscriptionsRequest) returns (livekit.UpdateSubscriptionsResponse) { + option (psrpc.options) = { + topics: true + topic_params: { + group: "participant" + names: ["participant"] + typed: true + }; + }; + }; +} diff --git a/rpc/participant.psrpc.go b/rpc/participant.psrpc.go new file mode 100644 index 000000000..c69b55259 --- /dev/null +++ b/rpc/participant.psrpc.go @@ -0,0 +1,224 @@ +// Code generated by protoc-gen-psrpc v0.4.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/server" + "github.com/livekit/psrpc/version" +) +import livekit "github.com/livekit/protocol/livekit" +import livekit3 "github.com/livekit/protocol/livekit" + +var _ = version.PsrpcVersion_0_4 + +// ============================ +// Participant Client Interface +// ============================ + +type ParticipantClient[ParticipantTopicType ~string] interface { + RemoveParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit3.RoomParticipantIdentity, opts ...psrpc.RequestOption) (*livekit3.RemoveParticipantResponse, error) + + MutePublishedTrack(ctx context.Context, participant ParticipantTopicType, req *livekit3.MuteRoomTrackRequest, opts ...psrpc.RequestOption) (*livekit3.MuteRoomTrackResponse, error) + + UpdateParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit3.UpdateParticipantRequest, opts ...psrpc.RequestOption) (*livekit.ParticipantInfo, error) + + UpdateSubscriptions(ctx context.Context, participant ParticipantTopicType, req *livekit3.UpdateSubscriptionsRequest, opts ...psrpc.RequestOption) (*livekit3.UpdateSubscriptionsResponse, error) +} + +// ================================ +// Participant ServerImpl Interface +// ================================ + +type ParticipantServerImpl interface { + RemoveParticipant(context.Context, *livekit3.RoomParticipantIdentity) (*livekit3.RemoveParticipantResponse, error) + + MutePublishedTrack(context.Context, *livekit3.MuteRoomTrackRequest) (*livekit3.MuteRoomTrackResponse, error) + + UpdateParticipant(context.Context, *livekit3.UpdateParticipantRequest) (*livekit.ParticipantInfo, error) + + UpdateSubscriptions(context.Context, *livekit3.UpdateSubscriptionsRequest) (*livekit3.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](clientID string, bus psrpc.MessageBus, opts ...psrpc.ClientOption) (ParticipantClient[ParticipantTopicType], error) { + sd := &info.ServiceDefinition{ + Name: "Participant", + ID: clientID, + } + + 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 *livekit3.RoomParticipantIdentity, opts ...psrpc.RequestOption) (*livekit3.RemoveParticipantResponse, error) { + return client.RequestSingle[*livekit3.RemoveParticipantResponse](ctx, c.client, "RemoveParticipant", []string{string(participant)}, req, opts...) +} + +func (c *participantClient[ParticipantTopicType]) MutePublishedTrack(ctx context.Context, participant ParticipantTopicType, req *livekit3.MuteRoomTrackRequest, opts ...psrpc.RequestOption) (*livekit3.MuteRoomTrackResponse, error) { + return client.RequestSingle[*livekit3.MuteRoomTrackResponse](ctx, c.client, "MutePublishedTrack", []string{string(participant)}, req, opts...) +} + +func (c *participantClient[ParticipantTopicType]) UpdateParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit3.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 *livekit3.UpdateSubscriptionsRequest, opts ...psrpc.RequestOption) (*livekit3.UpdateSubscriptionsResponse, error) { + return client.RequestSingle[*livekit3.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](serverID string, svc ParticipantServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (ParticipantServer[ParticipantTopicType], error) { + sd := &info.ServiceDefinition{ + Name: "Participant", + ID: serverID, + } + + 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 psrpcFileDescriptor4 = []byte{ + // 299 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, 0x50, 0xa9, 0xb5, 0x27, 0x91, 0x04, + 0xf4, 0x0d, 0xbc, 0x79, 0x10, 0x4a, 0xd4, 0x8b, 0x17, 0x49, 0x36, 0x63, 0xbb, 0xe4, 0xcf, 0x8c, + 0xbb, 0x93, 0x40, 0x4f, 0xde, 0x04, 0x7d, 0x1c, 0x9f, 0x50, 0xda, 0x34, 0x69, 0x5a, 0x51, 0xda, + 0x53, 0xc8, 0xef, 0x9b, 0xf9, 0xbe, 0x9d, 0xd9, 0x15, 0xc7, 0x86, 0x94, 0x4f, 0xa1, 0x61, 0xad, + 0x34, 0x85, 0x39, 0x7b, 0x64, 0x90, 0x51, 0xee, 0x18, 0x52, 0xee, 0x3e, 0x12, 0x6b, 0xcc, 0x6d, + 0xc5, 0xdc, 0xa3, 0x54, 0x97, 0x90, 0x68, 0x7e, 0xc9, 0x30, 0x86, 0xb4, 0xa6, 0xb2, 0xa6, 0x06, + 0x31, 0xab, 0xd8, 0xf5, 0xd7, 0xae, 0xe8, 0x8c, 0x96, 0x9e, 0xf2, 0x5d, 0x74, 0x03, 0xc8, 0xb0, + 0x84, 0x36, 0xec, 0x7b, 0x8b, 0x4e, 0x2f, 0x40, 0xcc, 0x5a, 0xca, 0x5d, 0x0c, 0x39, 0x6b, 0x9e, + 0xba, 0x83, 0x65, 0xc5, 0x7a, 0x77, 0x00, 0x96, 0x30, 0xb7, 0x30, 0x18, 0x7e, 0x7f, 0x3a, 0xfd, + 0x03, 0xc7, 0x3d, 0x11, 0x9d, 0xd6, 0x14, 0xb2, 0xfd, 0xd3, 0x73, 0xe4, 0x54, 0xc8, 0xfb, 0x82, + 0x61, 0x54, 0x44, 0xa9, 0xb6, 0x13, 0x88, 0x1f, 0x4d, 0xa8, 0x12, 0x79, 0xda, 0xf8, 0xcf, 0xc4, + 0xd9, 0x29, 0xe6, 0x3c, 0x80, 0xb7, 0x02, 0x2c, 0xbb, 0x67, 0x7f, 0xc9, 0x5b, 0x45, 0x97, 0xa2, + 0xfb, 0x44, 0x71, 0xc8, 0x2b, 0xb3, 0x9f, 0x37, 0xd6, 0xbf, 0xb4, 0x3a, 0xbd, 0xd7, 0x94, 0xb4, + 0x57, 0x93, 0xbf, 0xe2, 0x86, 0xb9, 0x1f, 0x8e, 0x38, 0xac, 0xcc, 0x1f, 0x8a, 0xc8, 0x2a, 0xa3, + 0xab, 0xbb, 0x94, 0x17, 0x6b, 0xd1, 0x2b, 0x6a, 0x1d, 0x3e, 0xfc, 0xbf, 0x68, 0x9b, 0x05, 0xdc, + 0x5e, 0x3d, 0x5f, 0x8e, 0x35, 0x4f, 0x8a, 0xc8, 0x53, 0x98, 0xf9, 0x0b, 0xdf, 0xe6, 0x4b, 0xc9, + 0xd8, 0xb7, 0x60, 0x4a, 0xad, 0xc0, 0x37, 0xa4, 0xa2, 0xbd, 0xf9, 0x0b, 0xba, 0xf9, 0x09, 0x00, + 0x00, 0xff, 0xff, 0x0d, 0x71, 0xfb, 0x47, 0x98, 0x02, 0x00, 0x00, +} diff --git a/rpc/room.pb.go b/rpc/room.pb.go index dc3312e35..b9b24c67a 100644 --- a/rpc/room.pb.go +++ b/rpc/room.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v3.21.12 +// protoc v4.23.4 // source: rpc/room.proto package rpc @@ -28,99 +28,51 @@ var file_rpc_room_proto_rawDesc = []byte{ 0x12, 0x03, 0x72, 0x70, 0x63, 0x1a, 0x0d, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x6c, 0x69, 0x76, 0x65, - 0x6b, 0x69, 0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x9c, - 0x06, 0x0a, 0x04, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x7f, 0x0a, 0x11, 0x52, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x20, 0x2e, 0x6c, - 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x50, 0x61, 0x72, 0x74, 0x69, - 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x22, - 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, - 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x24, 0xb2, 0x89, 0x01, 0x20, 0x10, 0x01, 0x1a, 0x1c, 0x0a, 0x0b, 0x70, 0x61, - 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, - 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x18, 0x01, 0x12, 0x79, 0x0a, 0x12, 0x4d, 0x75, 0x74, 0x65, - 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, 0x1d, - 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x6f, - 0x6d, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, - 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, - 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0xb2, - 0x89, 0x01, 0x20, 0x10, 0x01, 0x1a, 0x1c, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, - 0x70, 0x61, 0x6e, 0x74, 0x12, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, - 0x74, 0x18, 0x01, 0x12, 0x76, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x21, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, - 0x69, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, - 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x69, - 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, - 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x24, 0xb2, 0x89, 0x01, 0x20, 0x10, 0x01, 0x1a, 0x1c, 0x0a, - 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x0b, 0x70, 0x61, - 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x18, 0x01, 0x12, 0x86, 0x01, 0x0a, 0x13, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x23, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, - 0x69, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, - 0xb2, 0x89, 0x01, 0x20, 0x10, 0x01, 0x1a, 0x1c, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, - 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, - 0x6e, 0x74, 0x18, 0x01, 0x12, 0x5d, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, - 0x6f, 0x6d, 0x12, 0x1a, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, - 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, - 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0xb2, 0x89, 0x01, - 0x12, 0x10, 0x01, 0x1a, 0x0e, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x12, 0x04, 0x72, 0x6f, 0x6f, - 0x6d, 0x18, 0x01, 0x12, 0x57, 0x0a, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, - 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x44, 0x61, - 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6c, 0x69, 0x76, 0x65, - 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0xb2, 0x89, 0x01, 0x12, 0x10, 0x01, 0x1a, 0x0e, 0x0a, 0x04, - 0x72, 0x6f, 0x6f, 0x6d, 0x12, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x01, 0x12, 0x5f, 0x0a, 0x12, + 0x6b, 0x69, 0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x9f, + 0x02, 0x0a, 0x04, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x5d, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x1a, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, + 0xb2, 0x89, 0x01, 0x12, 0x10, 0x01, 0x1a, 0x0e, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x12, 0x04, + 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x01, 0x12, 0x57, 0x0a, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x44, 0x61, + 0x74, 0x61, 0x12, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x6e, + 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6c, + 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0xb2, 0x89, 0x01, 0x12, 0x10, 0x01, 0x1a, + 0x0e, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x12, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x01, 0x12, + 0x5f, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x22, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x12, 0x22, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, - 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x22, 0x16, 0xb2, 0x89, 0x01, 0x12, 0x10, 0x01, 0x1a, 0x0e, 0x0a, - 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x12, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x01, 0x42, 0x2c, 0x5a, - 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, - 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x70, 0x6b, 0x67, 0x2f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x6c, 0x69, 0x76, 0x65, + 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x22, 0x16, 0xb2, 0x89, 0x01, 0x12, 0x10, 0x01, + 0x1a, 0x0e, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x12, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x01, + 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, + 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x70, + 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_rpc_room_proto_goTypes = []interface{}{ - (*livekit.RoomParticipantIdentity)(nil), // 0: livekit.RoomParticipantIdentity - (*livekit.MuteRoomTrackRequest)(nil), // 1: livekit.MuteRoomTrackRequest - (*livekit.UpdateParticipantRequest)(nil), // 2: livekit.UpdateParticipantRequest - (*livekit.UpdateSubscriptionsRequest)(nil), // 3: livekit.UpdateSubscriptionsRequest - (*livekit.DeleteRoomRequest)(nil), // 4: livekit.DeleteRoomRequest - (*livekit.SendDataRequest)(nil), // 5: livekit.SendDataRequest - (*livekit.UpdateRoomMetadataRequest)(nil), // 6: livekit.UpdateRoomMetadataRequest - (*livekit.RemoveParticipantResponse)(nil), // 7: livekit.RemoveParticipantResponse - (*livekit.MuteRoomTrackResponse)(nil), // 8: livekit.MuteRoomTrackResponse - (*livekit.ParticipantInfo)(nil), // 9: livekit.ParticipantInfo - (*livekit.UpdateSubscriptionsResponse)(nil), // 10: livekit.UpdateSubscriptionsResponse - (*livekit.DeleteRoomResponse)(nil), // 11: livekit.DeleteRoomResponse - (*livekit.SendDataResponse)(nil), // 12: livekit.SendDataResponse - (*livekit.Room)(nil), // 13: livekit.Room + (*livekit.DeleteRoomRequest)(nil), // 0: livekit.DeleteRoomRequest + (*livekit.SendDataRequest)(nil), // 1: livekit.SendDataRequest + (*livekit.UpdateRoomMetadataRequest)(nil), // 2: livekit.UpdateRoomMetadataRequest + (*livekit.DeleteRoomResponse)(nil), // 3: livekit.DeleteRoomResponse + (*livekit.SendDataResponse)(nil), // 4: livekit.SendDataResponse + (*livekit.Room)(nil), // 5: livekit.Room } var file_rpc_room_proto_depIdxs = []int32{ - 0, // 0: rpc.Room.RemoveParticipant:input_type -> livekit.RoomParticipantIdentity - 1, // 1: rpc.Room.MutePublishedTrack:input_type -> livekit.MuteRoomTrackRequest - 2, // 2: rpc.Room.UpdateParticipant:input_type -> livekit.UpdateParticipantRequest - 3, // 3: rpc.Room.UpdateSubscriptions:input_type -> livekit.UpdateSubscriptionsRequest - 4, // 4: rpc.Room.DeleteRoom:input_type -> livekit.DeleteRoomRequest - 5, // 5: rpc.Room.SendData:input_type -> livekit.SendDataRequest - 6, // 6: rpc.Room.UpdateRoomMetadata:input_type -> livekit.UpdateRoomMetadataRequest - 7, // 7: rpc.Room.RemoveParticipant:output_type -> livekit.RemoveParticipantResponse - 8, // 8: rpc.Room.MutePublishedTrack:output_type -> livekit.MuteRoomTrackResponse - 9, // 9: rpc.Room.UpdateParticipant:output_type -> livekit.ParticipantInfo - 10, // 10: rpc.Room.UpdateSubscriptions:output_type -> livekit.UpdateSubscriptionsResponse - 11, // 11: rpc.Room.DeleteRoom:output_type -> livekit.DeleteRoomResponse - 12, // 12: rpc.Room.SendData:output_type -> livekit.SendDataResponse - 13, // 13: rpc.Room.UpdateRoomMetadata:output_type -> livekit.Room - 7, // [7:14] is the sub-list for method output_type - 0, // [0:7] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: rpc.Room.DeleteRoom:input_type -> livekit.DeleteRoomRequest + 1, // 1: rpc.Room.SendData:input_type -> livekit.SendDataRequest + 2, // 2: rpc.Room.UpdateRoomMetadata:input_type -> livekit.UpdateRoomMetadataRequest + 3, // 3: rpc.Room.DeleteRoom:output_type -> livekit.DeleteRoomResponse + 4, // 4: rpc.Room.SendData:output_type -> livekit.SendDataResponse + 5, // 5: rpc.Room.UpdateRoomMetadata:output_type -> livekit.Room + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_rpc_room_proto_init() } diff --git a/rpc/room.proto b/rpc/room.proto index f15aaeb54..4ea744381 100644 --- a/rpc/room.proto +++ b/rpc/room.proto @@ -9,46 +9,6 @@ import "livekit_models.proto"; import "livekit_room.proto"; service Room { - rpc RemoveParticipant(livekit.RoomParticipantIdentity) returns (livekit.RemoveParticipantResponse) { - option (psrpc.options) = { - topics: true - topic_params: { - group: "participant" - names: ["participant"] - typed: true - }; - }; - }; - rpc MutePublishedTrack(livekit.MuteRoomTrackRequest) returns (livekit.MuteRoomTrackResponse) { - option (psrpc.options) = { - topics: true - topic_params: { - group: "participant" - names: ["participant"] - typed: true - }; - }; - }; - rpc UpdateParticipant(livekit.UpdateParticipantRequest) returns (livekit.ParticipantInfo) { - option (psrpc.options) = { - topics: true - topic_params: { - group: "participant" - names: ["participant"] - typed: true - }; - }; - }; - rpc UpdateSubscriptions(livekit.UpdateSubscriptionsRequest) returns (livekit.UpdateSubscriptionsResponse) { - option (psrpc.options) = { - topics: true - topic_params: { - group: "participant" - names: ["participant"] - typed: true - }; - }; - }; rpc DeleteRoom(livekit.DeleteRoomRequest) returns (livekit.DeleteRoomResponse) { option (psrpc.options) = { topics: true diff --git a/rpc/room.psrpc.go b/rpc/room.psrpc.go index 215012c9e..bc02a456e 100644 --- a/rpc/room.psrpc.go +++ b/rpc/room.psrpc.go @@ -21,15 +21,7 @@ var _ = version.PsrpcVersion_0_4 // Room Client Interface // ===================== -type RoomClient[ParticipantTopicType, RoomTopicType ~string] interface { - RemoveParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit3.RoomParticipantIdentity, opts ...psrpc.RequestOption) (*livekit3.RemoveParticipantResponse, error) - - MutePublishedTrack(ctx context.Context, participant ParticipantTopicType, req *livekit3.MuteRoomTrackRequest, opts ...psrpc.RequestOption) (*livekit3.MuteRoomTrackResponse, error) - - UpdateParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit3.UpdateParticipantRequest, opts ...psrpc.RequestOption) (*livekit.ParticipantInfo, error) - - UpdateSubscriptions(ctx context.Context, participant ParticipantTopicType, req *livekit3.UpdateSubscriptionsRequest, opts ...psrpc.RequestOption) (*livekit3.UpdateSubscriptionsResponse, error) - +type RoomClient[RoomTopicType ~string] interface { DeleteRoom(ctx context.Context, room RoomTopicType, req *livekit3.DeleteRoomRequest, opts ...psrpc.RequestOption) (*livekit3.DeleteRoomResponse, error) SendData(ctx context.Context, room RoomTopicType, req *livekit3.SendDataRequest, opts ...psrpc.RequestOption) (*livekit3.SendDataResponse, error) @@ -42,14 +34,6 @@ type RoomClient[ParticipantTopicType, RoomTopicType ~string] interface { // ========================= type RoomServerImpl interface { - RemoveParticipant(context.Context, *livekit3.RoomParticipantIdentity) (*livekit3.RemoveParticipantResponse, error) - - MutePublishedTrack(context.Context, *livekit3.MuteRoomTrackRequest) (*livekit3.MuteRoomTrackResponse, error) - - UpdateParticipant(context.Context, *livekit3.UpdateParticipantRequest) (*livekit.ParticipantInfo, error) - - UpdateSubscriptions(context.Context, *livekit3.UpdateSubscriptionsRequest) (*livekit3.UpdateSubscriptionsResponse, error) - DeleteRoom(context.Context, *livekit3.DeleteRoomRequest) (*livekit3.DeleteRoomResponse, error) SendData(context.Context, *livekit3.SendDataRequest) (*livekit3.SendDataResponse, error) @@ -61,23 +45,13 @@ type RoomServerImpl interface { // Room Server Interface // ===================== -type RoomServer[ParticipantTopicType, RoomTopicType ~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) +type RoomServer[RoomTopicType ~string] interface { RegisterDeleteRoomTopic(room RoomTopicType) error DeregisterDeleteRoomTopic(room RoomTopicType) RegisterSendDataTopic(room RoomTopicType) error DeregisterSendDataTopic(room RoomTopicType) RegisterUpdateRoomMetadataTopic(room RoomTopicType) error DeregisterUpdateRoomMetadataTopic(room RoomTopicType) - RegisterAllParticipantTopics(participant ParticipantTopicType) error - DeregisterAllParticipantTopics(participant ParticipantTopicType) RegisterAllRoomTopics(room RoomTopicType) error DeregisterAllRoomTopics(room RoomTopicType) @@ -92,21 +66,17 @@ type RoomServer[ParticipantTopicType, RoomTopicType ~string] interface { // Room Client // =========== -type roomClient[ParticipantTopicType, RoomTopicType ~string] struct { +type roomClient[RoomTopicType ~string] struct { client *client.RPCClient } // NewRoomClient creates a psrpc client that implements the RoomClient interface. -func NewRoomClient[ParticipantTopicType, RoomTopicType ~string](clientID string, bus psrpc.MessageBus, opts ...psrpc.ClientOption) (RoomClient[ParticipantTopicType, RoomTopicType], error) { +func NewRoomClient[RoomTopicType ~string](clientID string, bus psrpc.MessageBus, opts ...psrpc.ClientOption) (RoomClient[RoomTopicType], error) { sd := &info.ServiceDefinition{ Name: "Room", ID: clientID, } - 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("DeleteRoom", false, false, true, true) sd.RegisterMethod("SendData", false, false, true, true) sd.RegisterMethod("UpdateRoomMetadata", false, false, true, true) @@ -116,36 +86,20 @@ func NewRoomClient[ParticipantTopicType, RoomTopicType ~string](clientID string, return nil, err } - return &roomClient[ParticipantTopicType, RoomTopicType]{ + return &roomClient[RoomTopicType]{ client: rpcClient, }, nil } -func (c *roomClient[ParticipantTopicType, RoomTopicType]) RemoveParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit3.RoomParticipantIdentity, opts ...psrpc.RequestOption) (*livekit3.RemoveParticipantResponse, error) { - return client.RequestSingle[*livekit3.RemoveParticipantResponse](ctx, c.client, "RemoveParticipant", []string{string(participant)}, req, opts...) -} - -func (c *roomClient[ParticipantTopicType, RoomTopicType]) MutePublishedTrack(ctx context.Context, participant ParticipantTopicType, req *livekit3.MuteRoomTrackRequest, opts ...psrpc.RequestOption) (*livekit3.MuteRoomTrackResponse, error) { - return client.RequestSingle[*livekit3.MuteRoomTrackResponse](ctx, c.client, "MutePublishedTrack", []string{string(participant)}, req, opts...) -} - -func (c *roomClient[ParticipantTopicType, RoomTopicType]) UpdateParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit3.UpdateParticipantRequest, opts ...psrpc.RequestOption) (*livekit.ParticipantInfo, error) { - return client.RequestSingle[*livekit.ParticipantInfo](ctx, c.client, "UpdateParticipant", []string{string(participant)}, req, opts...) -} - -func (c *roomClient[ParticipantTopicType, RoomTopicType]) UpdateSubscriptions(ctx context.Context, participant ParticipantTopicType, req *livekit3.UpdateSubscriptionsRequest, opts ...psrpc.RequestOption) (*livekit3.UpdateSubscriptionsResponse, error) { - return client.RequestSingle[*livekit3.UpdateSubscriptionsResponse](ctx, c.client, "UpdateSubscriptions", []string{string(participant)}, req, opts...) -} - -func (c *roomClient[ParticipantTopicType, RoomTopicType]) DeleteRoom(ctx context.Context, room RoomTopicType, req *livekit3.DeleteRoomRequest, opts ...psrpc.RequestOption) (*livekit3.DeleteRoomResponse, error) { +func (c *roomClient[RoomTopicType]) DeleteRoom(ctx context.Context, room RoomTopicType, req *livekit3.DeleteRoomRequest, opts ...psrpc.RequestOption) (*livekit3.DeleteRoomResponse, error) { return client.RequestSingle[*livekit3.DeleteRoomResponse](ctx, c.client, "DeleteRoom", []string{string(room)}, req, opts...) } -func (c *roomClient[ParticipantTopicType, RoomTopicType]) SendData(ctx context.Context, room RoomTopicType, req *livekit3.SendDataRequest, opts ...psrpc.RequestOption) (*livekit3.SendDataResponse, error) { +func (c *roomClient[RoomTopicType]) SendData(ctx context.Context, room RoomTopicType, req *livekit3.SendDataRequest, opts ...psrpc.RequestOption) (*livekit3.SendDataResponse, error) { return client.RequestSingle[*livekit3.SendDataResponse](ctx, c.client, "SendData", []string{string(room)}, req, opts...) } -func (c *roomClient[ParticipantTopicType, RoomTopicType]) UpdateRoomMetadata(ctx context.Context, room RoomTopicType, req *livekit3.UpdateRoomMetadataRequest, opts ...psrpc.RequestOption) (*livekit.Room, error) { +func (c *roomClient[RoomTopicType]) UpdateRoomMetadata(ctx context.Context, room RoomTopicType, req *livekit3.UpdateRoomMetadataRequest, opts ...psrpc.RequestOption) (*livekit.Room, error) { return client.RequestSingle[*livekit.Room](ctx, c.client, "UpdateRoomMetadata", []string{string(room)}, req, opts...) } @@ -153,14 +107,14 @@ func (c *roomClient[ParticipantTopicType, RoomTopicType]) UpdateRoomMetadata(ctx // Room Server // =========== -type roomServer[ParticipantTopicType, RoomTopicType ~string] struct { +type roomServer[RoomTopicType ~string] struct { svc RoomServerImpl rpc *server.RPCServer } // NewRoomServer builds a RPCServer that will route requests // to the corresponding method in the provided svc implementation. -func NewRoomServer[ParticipantTopicType, RoomTopicType ~string](serverID string, svc RoomServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (RoomServer[ParticipantTopicType, RoomTopicType], error) { +func NewRoomServer[RoomTopicType ~string](serverID string, svc RoomServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (RoomServer[RoomTopicType], error) { sd := &info.ServiceDefinition{ Name: "Room", ID: serverID, @@ -168,93 +122,40 @@ func NewRoomServer[ParticipantTopicType, RoomTopicType ~string](serverID string, 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("DeleteRoom", false, false, true, true) sd.RegisterMethod("SendData", false, false, true, true) sd.RegisterMethod("UpdateRoomMetadata", false, false, true, true) - return &roomServer[ParticipantTopicType, RoomTopicType]{ + return &roomServer[RoomTopicType]{ svc: svc, rpc: s, }, nil } -func (s *roomServer[ParticipantTopicType, RoomTopicType]) RegisterRemoveParticipantTopic(participant ParticipantTopicType) error { - return server.RegisterHandler(s.rpc, "RemoveParticipant", []string{string(participant)}, s.svc.RemoveParticipant, nil) -} - -func (s *roomServer[ParticipantTopicType, RoomTopicType]) DeregisterRemoveParticipantTopic(participant ParticipantTopicType) { - s.rpc.DeregisterHandler("RemoveParticipant", []string{string(participant)}) -} - -func (s *roomServer[ParticipantTopicType, RoomTopicType]) RegisterMutePublishedTrackTopic(participant ParticipantTopicType) error { - return server.RegisterHandler(s.rpc, "MutePublishedTrack", []string{string(participant)}, s.svc.MutePublishedTrack, nil) -} - -func (s *roomServer[ParticipantTopicType, RoomTopicType]) DeregisterMutePublishedTrackTopic(participant ParticipantTopicType) { - s.rpc.DeregisterHandler("MutePublishedTrack", []string{string(participant)}) -} - -func (s *roomServer[ParticipantTopicType, RoomTopicType]) RegisterUpdateParticipantTopic(participant ParticipantTopicType) error { - return server.RegisterHandler(s.rpc, "UpdateParticipant", []string{string(participant)}, s.svc.UpdateParticipant, nil) -} - -func (s *roomServer[ParticipantTopicType, RoomTopicType]) DeregisterUpdateParticipantTopic(participant ParticipantTopicType) { - s.rpc.DeregisterHandler("UpdateParticipant", []string{string(participant)}) -} - -func (s *roomServer[ParticipantTopicType, RoomTopicType]) RegisterUpdateSubscriptionsTopic(participant ParticipantTopicType) error { - return server.RegisterHandler(s.rpc, "UpdateSubscriptions", []string{string(participant)}, s.svc.UpdateSubscriptions, nil) -} - -func (s *roomServer[ParticipantTopicType, RoomTopicType]) DeregisterUpdateSubscriptionsTopic(participant ParticipantTopicType) { - s.rpc.DeregisterHandler("UpdateSubscriptions", []string{string(participant)}) -} - -func (s *roomServer[ParticipantTopicType, RoomTopicType]) RegisterDeleteRoomTopic(room RoomTopicType) error { +func (s *roomServer[RoomTopicType]) RegisterDeleteRoomTopic(room RoomTopicType) error { return server.RegisterHandler(s.rpc, "DeleteRoom", []string{string(room)}, s.svc.DeleteRoom, nil) } -func (s *roomServer[ParticipantTopicType, RoomTopicType]) DeregisterDeleteRoomTopic(room RoomTopicType) { +func (s *roomServer[RoomTopicType]) DeregisterDeleteRoomTopic(room RoomTopicType) { s.rpc.DeregisterHandler("DeleteRoom", []string{string(room)}) } -func (s *roomServer[ParticipantTopicType, RoomTopicType]) RegisterSendDataTopic(room RoomTopicType) error { +func (s *roomServer[RoomTopicType]) RegisterSendDataTopic(room RoomTopicType) error { return server.RegisterHandler(s.rpc, "SendData", []string{string(room)}, s.svc.SendData, nil) } -func (s *roomServer[ParticipantTopicType, RoomTopicType]) DeregisterSendDataTopic(room RoomTopicType) { +func (s *roomServer[RoomTopicType]) DeregisterSendDataTopic(room RoomTopicType) { s.rpc.DeregisterHandler("SendData", []string{string(room)}) } -func (s *roomServer[ParticipantTopicType, RoomTopicType]) RegisterUpdateRoomMetadataTopic(room RoomTopicType) error { +func (s *roomServer[RoomTopicType]) RegisterUpdateRoomMetadataTopic(room RoomTopicType) error { return server.RegisterHandler(s.rpc, "UpdateRoomMetadata", []string{string(room)}, s.svc.UpdateRoomMetadata, nil) } -func (s *roomServer[ParticipantTopicType, RoomTopicType]) DeregisterUpdateRoomMetadataTopic(room RoomTopicType) { +func (s *roomServer[RoomTopicType]) DeregisterUpdateRoomMetadataTopic(room RoomTopicType) { s.rpc.DeregisterHandler("UpdateRoomMetadata", []string{string(room)}) } -func (s *roomServer[ParticipantTopicType, RoomTopicType]) 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 *roomServer[ParticipantTopicType, RoomTopicType]) RegisterAllParticipantTopics(participant ParticipantTopicType) error { - return s.allParticipantTopicRegisterers().Register(participant) -} - -func (s *roomServer[ParticipantTopicType, RoomTopicType]) DeregisterAllParticipantTopics(participant ParticipantTopicType) { - s.allParticipantTopicRegisterers().Deregister(participant) -} - -func (s *roomServer[ParticipantTopicType, RoomTopicType]) allRoomTopicRegisterers() server.RegistererSlice { +func (s *roomServer[RoomTopicType]) allRoomTopicRegisterers() server.RegistererSlice { return server.RegistererSlice{ server.NewRegisterer(s.RegisterDeleteRoomTopic, s.DeregisterDeleteRoomTopic), server.NewRegisterer(s.RegisterSendDataTopic, s.DeregisterSendDataTopic), @@ -262,46 +163,37 @@ func (s *roomServer[ParticipantTopicType, RoomTopicType]) allRoomTopicRegisterer } } -func (s *roomServer[ParticipantTopicType, RoomTopicType]) RegisterAllRoomTopics(room RoomTopicType) error { +func (s *roomServer[RoomTopicType]) RegisterAllRoomTopics(room RoomTopicType) error { return s.allRoomTopicRegisterers().Register(room) } -func (s *roomServer[ParticipantTopicType, RoomTopicType]) DeregisterAllRoomTopics(room RoomTopicType) { +func (s *roomServer[RoomTopicType]) DeregisterAllRoomTopics(room RoomTopicType) { s.allRoomTopicRegisterers().Deregister(room) } -func (s *roomServer[ParticipantTopicType, RoomTopicType]) Shutdown() { +func (s *roomServer[RoomTopicType]) Shutdown() { s.rpc.Close(false) } -func (s *roomServer[ParticipantTopicType, RoomTopicType]) Kill() { +func (s *roomServer[RoomTopicType]) Kill() { s.rpc.Close(true) } var psrpcFileDescriptor3 = []byte{ - // 384 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xdf, 0x6a, 0xf2, 0x30, - 0x18, 0xc6, 0x29, 0x9f, 0xc8, 0x47, 0x3e, 0x14, 0xcd, 0x37, 0x86, 0xeb, 0xfe, 0xe0, 0x9c, 0x47, - 0x63, 0xb4, 0xb0, 0xdd, 0xc1, 0xf0, 0x64, 0x07, 0x82, 0xd4, 0x8d, 0xc1, 0x60, 0x48, 0x9b, 0xbe, - 0xd3, 0x60, 0xdb, 0x64, 0x49, 0x5a, 0xf0, 0x68, 0x67, 0x03, 0xef, 0x61, 0x57, 0xe1, 0x15, 0x8e, - 0x5a, 0xd3, 0x56, 0xa7, 0xdb, 0x3c, 0x69, 0xe9, 0xf3, 0xbc, 0xef, 0xf3, 0x4b, 0xde, 0x26, 0xa8, - 0x2e, 0x38, 0xb1, 0x05, 0x63, 0xa1, 0xc5, 0x05, 0x53, 0x0c, 0xff, 0x11, 0x9c, 0x98, 0x35, 0xc6, - 0x15, 0x65, 0x91, 0xcc, 0x34, 0xf3, 0x20, 0xa0, 0x09, 0x4c, 0xa9, 0x1a, 0x85, 0xcc, 0x87, 0x40, - 0xab, 0x58, 0xab, 0x45, 0xf7, 0xf5, 0x47, 0x15, 0x55, 0x1c, 0xc6, 0x42, 0xfc, 0x86, 0x9a, 0x0e, - 0x84, 0x2c, 0x81, 0x81, 0x2b, 0x14, 0x25, 0x94, 0xbb, 0x91, 0xc2, 0x6d, 0x6b, 0xd5, 0x62, 0xa5, - 0x35, 0x25, 0xe7, 0xce, 0x87, 0x48, 0x51, 0x35, 0x33, 0x3b, 0x45, 0xc5, 0x66, 0xb7, 0x03, 0x92, - 0xb3, 0x48, 0x42, 0xa7, 0xbb, 0x98, 0x1b, 0xed, 0x86, 0x61, 0x9e, 0xa0, 0x7f, 0xbc, 0x14, 0x5e, - 0xfe, 0x68, 0x19, 0x78, 0x86, 0x70, 0x3f, 0x56, 0x30, 0x88, 0xbd, 0x80, 0xca, 0x09, 0xf8, 0xf7, - 0xc2, 0x25, 0x53, 0x7c, 0x9a, 0xe7, 0xa7, 0x66, 0xba, 0x8a, 0xa5, 0xee, 0xc0, 0x6b, 0x0c, 0x52, - 0x99, 0x67, 0xbb, 0xec, 0xbd, 0xd0, 0x09, 0x6a, 0x3e, 0x70, 0xdf, 0x55, 0x6b, 0x7b, 0x3f, 0xcf, - 0xa3, 0xbf, 0x78, 0x9a, 0xde, 0xca, 0x4b, 0xca, 0xa3, 0x89, 0x5e, 0xd8, 0x2f, 0xb9, 0xef, 0x06, - 0xfa, 0x9f, 0x85, 0x0f, 0x63, 0x4f, 0x12, 0x41, 0xb3, 0x9f, 0x88, 0x2f, 0x36, 0xd0, 0x6b, 0xae, - 0x86, 0x77, 0xbf, 0x2f, 0xda, 0x6b, 0x00, 0xcf, 0x08, 0xf5, 0x20, 0x80, 0x6c, 0x82, 0xd8, 0xcc, - 0x93, 0x0b, 0x51, 0x53, 0x8f, 0xb7, 0x7a, 0x2b, 0xd8, 0xe1, 0x62, 0x6e, 0xe0, 0x86, 0x61, 0xd6, - 0x51, 0x25, 0x3d, 0x62, 0x78, 0xf9, 0x6c, 0x19, 0xf8, 0x11, 0xfd, 0x1d, 0x42, 0xe4, 0xf7, 0x5c, - 0xe5, 0xe2, 0x62, 0x66, 0x5a, 0xd2, 0xd1, 0x47, 0x5b, 0x9c, 0x1f, 0x82, 0x47, 0x08, 0x67, 0x9b, - 0x4f, 0x97, 0xd1, 0x07, 0xe5, 0xfa, 0x29, 0xa2, 0xb3, 0x31, 0x99, 0xb2, 0xa9, 0x61, 0xb5, 0xb5, - 0x93, 0xbd, 0x0b, 0x70, 0x7b, 0xf5, 0x74, 0x39, 0xa6, 0x6a, 0x12, 0x7b, 0x16, 0x61, 0xa1, 0xbd, - 0x6a, 0xc9, 0xdf, 0x7c, 0x3a, 0xb6, 0x25, 0x88, 0x84, 0x12, 0xb0, 0x05, 0x27, 0x5e, 0x75, 0x79, - 0xa7, 0x6e, 0x3e, 0x03, 0x00, 0x00, 0xff, 0xff, 0xd8, 0xc1, 0x20, 0xb0, 0xa3, 0x03, 0x00, 0x00, + // 237 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2b, 0x2a, 0x48, 0xd6, + 0x2f, 0xca, 0xcf, 0xcf, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2e, 0x2a, 0x48, 0x96, + 0xe2, 0xcd, 0x2f, 0x28, 0xc9, 0xcc, 0xcf, 0x2b, 0x86, 0x88, 0x49, 0x89, 0xe4, 0x64, 0x96, 0xa5, + 0x66, 0x67, 0x96, 0xc4, 0xe7, 0xe6, 0xa7, 0xa4, 0xe6, 0xc0, 0x44, 0x85, 0x60, 0xa2, 0x08, 0xdd, + 0x46, 0xf3, 0x99, 0xb8, 0x58, 0x82, 0xf2, 0xf3, 0x73, 0x85, 0x62, 0xb9, 0xb8, 0x5c, 0x52, 0x73, + 0x52, 0x4b, 0x52, 0xc1, 0x3c, 0x29, 0x3d, 0xa8, 0x5a, 0x3d, 0x84, 0x60, 0x50, 0x6a, 0x61, 0x69, + 0x6a, 0x71, 0x89, 0x94, 0x34, 0x56, 0xb9, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0x25, 0xb1, 0x4d, + 0x9d, 0x8c, 0x42, 0x02, 0x8c, 0x52, 0x7c, 0x5c, 0x2c, 0x20, 0x5b, 0x84, 0xc0, 0xa4, 0x04, 0xa3, + 0x50, 0x38, 0x17, 0x47, 0x70, 0x6a, 0x5e, 0x8a, 0x4b, 0x62, 0x49, 0xa2, 0x90, 0x04, 0xdc, 0x00, + 0x98, 0x10, 0xcc, 0x68, 0x49, 0x2c, 0x32, 0x04, 0x0c, 0x8e, 0xe7, 0x12, 0x0a, 0x2d, 0x48, 0x49, + 0x84, 0x38, 0xc3, 0x37, 0xb5, 0x24, 0x31, 0x05, 0x64, 0x85, 0x12, 0xdc, 0x20, 0x4c, 0x49, 0x98, + 0x65, 0xbc, 0x70, 0x35, 0x20, 0x59, 0x5c, 0x16, 0x38, 0xe9, 0x44, 0x69, 0xa5, 0x67, 0x96, 0x64, + 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0xb5, 0xc0, 0xe9, 0x82, 0xec, 0x74, 0xfd, 0xe2, + 0xd4, 0xa2, 0xb2, 0xcc, 0xe4, 0x54, 0xfd, 0xa2, 0x82, 0xe4, 0x24, 0x36, 0x70, 0xb0, 0x1a, 0x03, + 0x02, 0x00, 0x00, 0xff, 0xff, 0x53, 0xa6, 0x88, 0x04, 0xa6, 0x01, 0x00, 0x00, } diff --git a/rpc/signal.pb.go b/rpc/signal.pb.go index c2057637a..f7a95aaf6 100644 --- a/rpc/signal.pb.go +++ b/rpc/signal.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v3.21.12 +// protoc v4.23.4 // source: rpc/signal.proto package rpc diff --git a/rpc/signal.psrpc.go b/rpc/signal.psrpc.go index 357c7568a..21bb816c8 100644 --- a/rpc/signal.psrpc.go +++ b/rpc/signal.psrpc.go @@ -119,7 +119,7 @@ func (s *signalServer[NodeIdTopicType]) Kill() { s.rpc.Close(true) } -var psrpcFileDescriptor4 = []byte{ +var psrpcFileDescriptor5 = []byte{ // 313 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xcf, 0x4e, 0x02, 0x31, 0x10, 0xc6, 0x53, 0x17, 0x10, 0x8b, 0x24, 0x58, 0x14, 0x9a, 0x3d, 0x6d, 0x38, 0x6d, 0x8c, 0xe9, diff --git a/rpc/typed_api.go b/rpc/typed_api.go index 19a66f19b..e1662aabc 100644 --- a/rpc/typed_api.go +++ b/rpc/typed_api.go @@ -19,6 +19,7 @@ import ( "fmt" "github.com/livekit/protocol/livekit" + "github.com/livekit/protocol/utils" "github.com/livekit/psrpc" ) @@ -51,14 +52,26 @@ type TopicFormatter interface { RoomTopic(ctx context.Context, roomName livekit.RoomName) RoomTopic } +//counterfeiter:generate . TypedParticipantClient +type TypedParticipantClient = ParticipantClient[ParticipantTopic] +type TypedParticipantServer = ParticipantServer[ParticipantTopic] + +func NewTypedParticipantClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (TypedParticipantClient, error) { + return NewParticipantClient[ParticipantTopic](utils.NewGuid("CLI_"), bus, opts...) +} + +func NewTypedParticipantServer(svc ParticipantServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) TypedParticipantServer { + return utils.Must(NewParticipantServer[ParticipantTopic](utils.NewGuid("SRV_"), svc, bus, opts...)) +} + //counterfeiter:generate . TypedRoomClient -type TypedRoomClient = RoomClient[ParticipantTopic, RoomTopic] -type TypedRoomServer = RoomServer[ParticipantTopic, RoomTopic] +type TypedRoomClient = RoomClient[RoomTopic] +type TypedRoomServer = RoomServer[RoomTopic] -func NewTypedRoomClient(nodeID livekit.NodeID, bus psrpc.MessageBus, opts ...psrpc.ClientOption) (TypedRoomClient, error) { - return NewRoomClient[ParticipantTopic, RoomTopic](string(nodeID), bus, opts...) +func NewTypedRoomClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (TypedRoomClient, error) { + return NewRoomClient[RoomTopic](utils.NewGuid("CLI_"), bus, opts...) } -func NewTypedRoomServer(nodeID livekit.NodeID, svc RoomServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (TypedRoomServer, error) { - return NewRoomServer[ParticipantTopic, RoomTopic](string(nodeID), svc, bus, opts...) +func NewTypedRoomServer(svc RoomServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) TypedRoomServer { + return utils.Must(NewRoomServer[RoomTopic](utils.NewGuid("SRV_"), svc, bus, opts...)) } diff --git a/utils/must.go b/utils/must.go new file mode 100644 index 000000000..897c561b4 --- /dev/null +++ b/utils/must.go @@ -0,0 +1,8 @@ +package utils + +func Must[T any](v T, err error) T { + if err != nil { + panic(err) + } + return v +}