// Code generated by protoc-gen-psrpc v0.7.0, DO NOT EDIT. // source: rpc/room.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_7 // ===================== // Room Client Interface // ===================== type RoomClient[RoomTopicType ~string] interface { DeleteRoom(ctx context.Context, room RoomTopicType, req *livekit6.DeleteRoomRequest, opts ...psrpc.RequestOption) (*livekit6.DeleteRoomResponse, error) SendData(ctx context.Context, room RoomTopicType, req *livekit6.SendDataRequest, opts ...psrpc.RequestOption) (*livekit6.SendDataResponse, error) UpdateRoomMetadata(ctx context.Context, room RoomTopicType, req *livekit6.UpdateRoomMetadataRequest, opts ...psrpc.RequestOption) (*livekit1.Room, error) ListParticipants(ctx context.Context, room RoomTopicType, req *livekit6.ListParticipantsRequest, opts ...psrpc.RequestOption) (*livekit6.ListParticipantsResponse, error) GetParticipant(ctx context.Context, room RoomTopicType, req *livekit6.RoomParticipantIdentity, opts ...psrpc.RequestOption) (*livekit1.ParticipantInfo, error) // Close immediately, without waiting for pending RPCs Close() } // ========================= // Room ServerImpl Interface // ========================= type RoomServerImpl interface { DeleteRoom(context.Context, *livekit6.DeleteRoomRequest) (*livekit6.DeleteRoomResponse, error) SendData(context.Context, *livekit6.SendDataRequest) (*livekit6.SendDataResponse, error) UpdateRoomMetadata(context.Context, *livekit6.UpdateRoomMetadataRequest) (*livekit1.Room, error) ListParticipants(context.Context, *livekit6.ListParticipantsRequest) (*livekit6.ListParticipantsResponse, error) GetParticipant(context.Context, *livekit6.RoomParticipantIdentity) (*livekit1.ParticipantInfo, error) } // ===================== // Room Server Interface // ===================== 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) RegisterListParticipantsTopic(room RoomTopicType) error DeregisterListParticipantsTopic(room RoomTopicType) RegisterGetParticipantTopic(room RoomTopicType) error DeregisterGetParticipantTopic(room RoomTopicType) RegisterAllRoomTopics(room RoomTopicType) error DeregisterAllRoomTopics(room RoomTopicType) // Close and wait for pending RPCs to complete Shutdown() // Close immediately, without waiting for pending RPCs Kill() } // =========== // Room Client // =========== type roomClient[RoomTopicType ~string] struct { client *client.RPCClient } // NewRoomClient creates a psrpc client that implements the RoomClient interface. func NewRoomClient[RoomTopicType ~string](bus psrpc.MessageBus, opts ...psrpc.ClientOption) (RoomClient[RoomTopicType], error) { sd := &info.ServiceDefinition{ Name: "Room", ID: rand.NewClientID(), } sd.RegisterMethod("DeleteRoom", false, false, true, true) sd.RegisterMethod("SendData", false, false, true, true) sd.RegisterMethod("UpdateRoomMetadata", false, false, true, true) sd.RegisterMethod("ListParticipants", false, false, true, true) sd.RegisterMethod("GetParticipant", false, false, true, true) rpcClient, err := client.NewRPCClient(sd, bus, opts...) if err != nil { return nil, err } return &roomClient[RoomTopicType]{ client: rpcClient, }, nil } func (c *roomClient[RoomTopicType]) DeleteRoom(ctx context.Context, room RoomTopicType, req *livekit6.DeleteRoomRequest, opts ...psrpc.RequestOption) (*livekit6.DeleteRoomResponse, error) { return client.RequestSingle[*livekit6.DeleteRoomResponse](ctx, c.client, "DeleteRoom", []string{string(room)}, req, opts...) } func (c *roomClient[RoomTopicType]) SendData(ctx context.Context, room RoomTopicType, req *livekit6.SendDataRequest, opts ...psrpc.RequestOption) (*livekit6.SendDataResponse, error) { return client.RequestSingle[*livekit6.SendDataResponse](ctx, c.client, "SendData", []string{string(room)}, req, opts...) } func (c *roomClient[RoomTopicType]) UpdateRoomMetadata(ctx context.Context, room RoomTopicType, req *livekit6.UpdateRoomMetadataRequest, opts ...psrpc.RequestOption) (*livekit1.Room, error) { return client.RequestSingle[*livekit1.Room](ctx, c.client, "UpdateRoomMetadata", []string{string(room)}, req, opts...) } func (c *roomClient[RoomTopicType]) ListParticipants(ctx context.Context, room RoomTopicType, req *livekit6.ListParticipantsRequest, opts ...psrpc.RequestOption) (*livekit6.ListParticipantsResponse, error) { return client.RequestSingle[*livekit6.ListParticipantsResponse](ctx, c.client, "ListParticipants", []string{string(room)}, req, opts...) } func (c *roomClient[RoomTopicType]) GetParticipant(ctx context.Context, room RoomTopicType, req *livekit6.RoomParticipantIdentity, opts ...psrpc.RequestOption) (*livekit1.ParticipantInfo, error) { return client.RequestSingle[*livekit1.ParticipantInfo](ctx, c.client, "GetParticipant", []string{string(room)}, req, opts...) } func (s *roomClient[RoomTopicType]) Close() { s.client.Close() } // =========== // Room Server // =========== 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[RoomTopicType ~string](svc RoomServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (RoomServer[RoomTopicType], error) { sd := &info.ServiceDefinition{ Name: "Room", ID: rand.NewServerID(), } s := server.NewRPCServer(sd, bus, opts...) sd.RegisterMethod("DeleteRoom", false, false, true, true) sd.RegisterMethod("SendData", false, false, true, true) sd.RegisterMethod("UpdateRoomMetadata", false, false, true, true) sd.RegisterMethod("ListParticipants", false, false, true, true) sd.RegisterMethod("GetParticipant", false, false, true, true) return &roomServer[RoomTopicType]{ svc: svc, rpc: s, }, nil } func (s *roomServer[RoomTopicType]) RegisterDeleteRoomTopic(room RoomTopicType) error { return server.RegisterHandler(s.rpc, "DeleteRoom", []string{string(room)}, s.svc.DeleteRoom, nil) } func (s *roomServer[RoomTopicType]) DeregisterDeleteRoomTopic(room RoomTopicType) { s.rpc.DeregisterHandler("DeleteRoom", []string{string(room)}) } func (s *roomServer[RoomTopicType]) RegisterSendDataTopic(room RoomTopicType) error { return server.RegisterHandler(s.rpc, "SendData", []string{string(room)}, s.svc.SendData, nil) } func (s *roomServer[RoomTopicType]) DeregisterSendDataTopic(room RoomTopicType) { s.rpc.DeregisterHandler("SendData", []string{string(room)}) } func (s *roomServer[RoomTopicType]) RegisterUpdateRoomMetadataTopic(room RoomTopicType) error { return server.RegisterHandler(s.rpc, "UpdateRoomMetadata", []string{string(room)}, s.svc.UpdateRoomMetadata, nil) } func (s *roomServer[RoomTopicType]) DeregisterUpdateRoomMetadataTopic(room RoomTopicType) { s.rpc.DeregisterHandler("UpdateRoomMetadata", []string{string(room)}) } func (s *roomServer[RoomTopicType]) RegisterListParticipantsTopic(room RoomTopicType) error { return server.RegisterHandler(s.rpc, "ListParticipants", []string{string(room)}, s.svc.ListParticipants, nil) } func (s *roomServer[RoomTopicType]) DeregisterListParticipantsTopic(room RoomTopicType) { s.rpc.DeregisterHandler("ListParticipants", []string{string(room)}) } func (s *roomServer[RoomTopicType]) RegisterGetParticipantTopic(room RoomTopicType) error { return server.RegisterHandler(s.rpc, "GetParticipant", []string{string(room)}, s.svc.GetParticipant, nil) } func (s *roomServer[RoomTopicType]) DeregisterGetParticipantTopic(room RoomTopicType) { s.rpc.DeregisterHandler("GetParticipant", []string{string(room)}) } func (s *roomServer[RoomTopicType]) allRoomTopicRegisterers() server.RegistererSlice { return server.RegistererSlice{ server.NewRegisterer(s.RegisterDeleteRoomTopic, s.DeregisterDeleteRoomTopic), server.NewRegisterer(s.RegisterSendDataTopic, s.DeregisterSendDataTopic), server.NewRegisterer(s.RegisterUpdateRoomMetadataTopic, s.DeregisterUpdateRoomMetadataTopic), server.NewRegisterer(s.RegisterListParticipantsTopic, s.DeregisterListParticipantsTopic), server.NewRegisterer(s.RegisterGetParticipantTopic, s.DeregisterGetParticipantTopic), } } func (s *roomServer[RoomTopicType]) RegisterAllRoomTopics(room RoomTopicType) error { return s.allRoomTopicRegisterers().Register(room) } func (s *roomServer[RoomTopicType]) DeregisterAllRoomTopics(room RoomTopicType) { s.allRoomTopicRegisterers().Deregister(room) } func (s *roomServer[RoomTopicType]) Shutdown() { s.rpc.Close(false) } func (s *roomServer[RoomTopicType]) Kill() { s.rpc.Close(true) } // ========================= // Room Unimplemented Server // ========================= type UnimplementedRoomServer struct{} func (UnimplementedRoomServer) DeleteRoom(context.Context, *livekit6.DeleteRoomRequest) (*livekit6.DeleteRoomResponse, error) { return nil, psrpc.ErrUnimplemented } func (UnimplementedRoomServer) SendData(context.Context, *livekit6.SendDataRequest) (*livekit6.SendDataResponse, error) { return nil, psrpc.ErrUnimplemented } func (UnimplementedRoomServer) UpdateRoomMetadata(context.Context, *livekit6.UpdateRoomMetadataRequest) (*livekit1.Room, error) { return nil, psrpc.ErrUnimplemented } func (UnimplementedRoomServer) ListParticipants(context.Context, *livekit6.ListParticipantsRequest) (*livekit6.ListParticipantsResponse, error) { return nil, psrpc.ErrUnimplemented } func (UnimplementedRoomServer) GetParticipant(context.Context, *livekit6.RoomParticipantIdentity) (*livekit1.ParticipantInfo, error) { return nil, psrpc.ErrUnimplemented } var psrpcFileDescriptor7 = []byte{ // 290 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xe1, 0x4a, 0xfb, 0x30, 0x14, 0xc5, 0x29, 0x1b, 0x7f, 0xfe, 0x04, 0x56, 0x46, 0x10, 0x99, 0xf1, 0x83, 0x6e, 0x0f, 0xd0, 0x82, 0xbe, 0x81, 0x0c, 0x44, 0x50, 0x90, 0x89, 0x08, 0x82, 0x8c, 0x2c, 0xb9, 0x6a, 0xb0, 0xcd, 0x8d, 0xc9, 0x9d, 0xe0, 0x23, 0xf8, 0x3a, 0x3e, 0x9c, 0x9f, 0xa5, 0xdd, 0xd2, 0x16, 0xdd, 0xdc, 0x97, 0xc2, 0x3d, 0xbf, 0x7b, 0xce, 0xb9, 0x2d, 0x65, 0xa9, 0x77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