diff --git a/rpc/agent.pb.go b/rpc/agent.pb.go index a4c7fa7c..1872ebc0 100644 --- a/rpc/agent.pb.go +++ b/rpc/agent.pb.go @@ -27,6 +27,7 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" reflect "reflect" + sync "sync" ) const ( @@ -36,6 +37,99 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type CheckEnabledRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CheckEnabledRequest) Reset() { + *x = CheckEnabledRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_agent_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CheckEnabledRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckEnabledRequest) ProtoMessage() {} + +func (x *CheckEnabledRequest) ProtoReflect() protoreflect.Message { + mi := &file_rpc_agent_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CheckEnabledRequest.ProtoReflect.Descriptor instead. +func (*CheckEnabledRequest) Descriptor() ([]byte, []int) { + return file_rpc_agent_proto_rawDescGZIP(), []int{0} +} + +type CheckEnabledResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RoomEnabled bool `protobuf:"varint,1,opt,name=room_enabled,json=roomEnabled,proto3" json:"room_enabled,omitempty"` + PublisherEnabled bool `protobuf:"varint,2,opt,name=publisher_enabled,json=publisherEnabled,proto3" json:"publisher_enabled,omitempty"` +} + +func (x *CheckEnabledResponse) Reset() { + *x = CheckEnabledResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_agent_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CheckEnabledResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckEnabledResponse) ProtoMessage() {} + +func (x *CheckEnabledResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_agent_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CheckEnabledResponse.ProtoReflect.Descriptor instead. +func (*CheckEnabledResponse) Descriptor() ([]byte, []int) { + return file_rpc_agent_proto_rawDescGZIP(), []int{1} +} + +func (x *CheckEnabledResponse) GetRoomEnabled() bool { + if x != nil { + return x.RoomEnabled + } + return false +} + +func (x *CheckEnabledResponse) GetPublisherEnabled() bool { + if x != nil { + return x.PublisherEnabled + } + return false +} + var File_rpc_agent_proto protoreflect.FileDescriptor var file_rpc_agent_proto_rawDesc = []byte{ @@ -44,26 +138,56 @@ var file_rpc_agent_proto_rawDesc = []byte{ 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x5f, 0x61, 0x67, 0x65, 0x6e, - 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x4d, 0x0a, 0x0d, 0x41, 0x67, 0x65, 0x6e, 0x74, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x12, 0x3c, 0x0a, 0x0a, 0x4a, 0x6f, 0x62, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0c, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, - 0x2e, 0x4a, 0x6f, 0x62, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x08, 0xb2, 0x89, - 0x01, 0x04, 0x10, 0x01, 0x30, 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, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x15, 0x0a, 0x13, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x66, + 0x0a, 0x14, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x72, 0x6f, + 0x6f, 0x6d, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x70, 0x75, 0x62, + 0x6c, 0x69, 0x73, 0x68, 0x65, 0x72, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x72, 0x45, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x32, 0x9a, 0x01, 0x0a, 0x0d, 0x41, 0x67, 0x65, 0x6e, 0x74, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x12, 0x4b, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x18, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xb2, + 0x89, 0x01, 0x02, 0x28, 0x01, 0x12, 0x3c, 0x0a, 0x0a, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x0c, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4a, 0x6f, + 0x62, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x08, 0xb2, 0x89, 0x01, 0x04, 0x10, + 0x01, 0x30, 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_agent_proto_rawDescOnce sync.Once + file_rpc_agent_proto_rawDescData = file_rpc_agent_proto_rawDesc +) + +func file_rpc_agent_proto_rawDescGZIP() []byte { + file_rpc_agent_proto_rawDescOnce.Do(func() { + file_rpc_agent_proto_rawDescData = protoimpl.X.CompressGZIP(file_rpc_agent_proto_rawDescData) + }) + return file_rpc_agent_proto_rawDescData +} + +var file_rpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_rpc_agent_proto_goTypes = []interface{}{ - (*livekit.Job)(nil), // 0: livekit.Job - (*emptypb.Empty)(nil), // 1: google.protobuf.Empty + (*CheckEnabledRequest)(nil), // 0: rpc.CheckEnabledRequest + (*CheckEnabledResponse)(nil), // 1: rpc.CheckEnabledResponse + (*livekit.Job)(nil), // 2: livekit.Job + (*emptypb.Empty)(nil), // 3: google.protobuf.Empty } var file_rpc_agent_proto_depIdxs = []int32{ - 0, // 0: rpc.AgentInternal.JobRequest:input_type -> livekit.Job - 1, // 1: rpc.AgentInternal.JobRequest:output_type -> google.protobuf.Empty - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type + 0, // 0: rpc.AgentInternal.CheckEnabled:input_type -> rpc.CheckEnabledRequest + 2, // 1: rpc.AgentInternal.JobRequest:input_type -> livekit.Job + 1, // 2: rpc.AgentInternal.CheckEnabled:output_type -> rpc.CheckEnabledResponse + 3, // 3: rpc.AgentInternal.JobRequest:output_type -> google.protobuf.Empty + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] 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 @@ -74,18 +198,45 @@ func file_rpc_agent_proto_init() { if File_rpc_agent_proto != nil { return } + if !protoimpl.UnsafeEnabled { + file_rpc_agent_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CheckEnabledRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_agent_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CheckEnabledResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_rpc_agent_proto_rawDesc, NumEnums: 0, - NumMessages: 0, + NumMessages: 2, NumExtensions: 0, NumServices: 1, }, GoTypes: file_rpc_agent_proto_goTypes, DependencyIndexes: file_rpc_agent_proto_depIdxs, + MessageInfos: file_rpc_agent_proto_msgTypes, }.Build() File_rpc_agent_proto = out.File file_rpc_agent_proto_rawDesc = nil diff --git a/rpc/agent.proto b/rpc/agent.proto index f4cb1efa..a6cff912 100644 --- a/rpc/agent.proto +++ b/rpc/agent.proto @@ -23,8 +23,18 @@ import "options.proto"; import "livekit_agent.proto"; service AgentInternal { + rpc CheckEnabled(CheckEnabledRequest) returns (CheckEnabledResponse) { + option (psrpc.options).multi = true; + }; rpc JobRequest(livekit.Job) returns (google.protobuf.Empty) { option (psrpc.options).affinity_func = true; option (psrpc.options).topics = true; }; } + +message CheckEnabledRequest{} + +message CheckEnabledResponse { + bool room_enabled = 1; + bool publisher_enabled = 2; +} diff --git a/rpc/agent.psrpc.go b/rpc/agent.psrpc.go index 6fc06453..2c153a1a 100644 --- a/rpc/agent.psrpc.go +++ b/rpc/agent.psrpc.go @@ -23,6 +23,8 @@ var _ = version.PsrpcVersion_0_5 // ============================== type AgentInternalClient interface { + CheckEnabled(ctx context.Context, req *CheckEnabledRequest, opts ...psrpc.RequestOption) (<-chan *psrpc.Response[*CheckEnabledResponse], error) + JobRequest(ctx context.Context, topic string, req *livekit1.Job, opts ...psrpc.RequestOption) (*google_protobuf.Empty, error) } @@ -31,6 +33,8 @@ type AgentInternalClient interface { // ================================== type AgentInternalServerImpl interface { + CheckEnabled(context.Context, *CheckEnabledRequest) (*CheckEnabledResponse, error) + JobRequest(context.Context, *livekit1.Job) (*google_protobuf.Empty, error) JobRequestAffinity(context.Context, *livekit1.Job) float32 } @@ -65,6 +69,7 @@ func NewAgentInternalClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (A ID: rand.NewClientID(), } + sd.RegisterMethod("CheckEnabled", false, true, false, false) sd.RegisterMethod("JobRequest", true, false, true, false) rpcClient, err := client.NewRPCClient(sd, bus, opts...) @@ -77,6 +82,10 @@ func NewAgentInternalClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (A }, nil } +func (c *agentInternalClient) CheckEnabled(ctx context.Context, req *CheckEnabledRequest, opts ...psrpc.RequestOption) (<-chan *psrpc.Response[*CheckEnabledResponse], error) { + return client.RequestMulti[*CheckEnabledResponse](ctx, c.client, "CheckEnabled", nil, req, opts...) +} + func (c *agentInternalClient) JobRequest(ctx context.Context, topic string, req *livekit1.Job, opts ...psrpc.RequestOption) (*google_protobuf.Empty, error) { return client.RequestSingle[*google_protobuf.Empty](ctx, c.client, "JobRequest", []string{topic}, req, opts...) } @@ -100,6 +109,14 @@ func NewAgentInternalServer(svc AgentInternalServerImpl, bus psrpc.MessageBus, o s := server.NewRPCServer(sd, bus, opts...) + sd.RegisterMethod("CheckEnabled", false, true, false, false) + var err error + err = server.RegisterHandler(s, "CheckEnabled", nil, svc.CheckEnabled, nil) + if err != nil { + s.Close(false) + return nil, err + } + sd.RegisterMethod("JobRequest", true, false, true, false) return &agentInternalServer{ svc: svc, @@ -124,17 +141,24 @@ func (s *agentInternalServer) Kill() { } var psrpcFileDescriptor0 = []byte{ - // 191 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0x2a, 0x48, 0xd6, - 0x4f, 0x4c, 0x4f, 0xcd, 0x2b, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2e, 0x2a, 0x48, - 0x96, 0x92, 0x4e, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x07, 0x0b, 0x25, 0x95, 0xa6, 0xe9, 0xa7, - 0xe6, 0x16, 0x94, 0x54, 0x42, 0x54, 0x48, 0xf1, 0xe6, 0x17, 0x94, 0x64, 0xe6, 0xe7, 0x15, 0x43, - 0xb9, 0xc2, 0x39, 0x99, 0x65, 0xa9, 0xd9, 0x99, 0x25, 0xf1, 0x48, 0xa6, 0x18, 0xf9, 0x73, 0xf1, - 0x3a, 0x82, 0xb8, 0x9e, 0x79, 0x25, 0xa9, 0x45, 0x79, 0x89, 0x39, 0x42, 0x76, 0x5c, 0x5c, 0x5e, - 0xf9, 0x49, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x3c, 0x7a, 0x50, 0x4d, 0x7a, 0x5e, - 0xf9, 0x49, 0x52, 0x62, 0x7a, 0x10, 0xeb, 0xf4, 0x60, 0xd6, 0xe9, 0xb9, 0x82, 0xac, 0x53, 0xe2, - 0xda, 0xd4, 0xc9, 0xc8, 0x26, 0xc0, 0xe8, 0xc0, 0x68, 0xc0, 0xe8, 0xa4, 0x13, 0xa5, 0x95, 0x9e, - 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0xd5, 0x0d, 0xa7, 0x0b, 0xb2, 0xd3, - 0xf5, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0x8b, 0x0a, 0x92, 0x93, 0xd8, 0xc0, 0x26, - 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x93, 0xd1, 0x7c, 0xde, 0x00, 0x00, 0x00, + // 292 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4e, 0x02, 0x31, + 0x10, 0x86, 0x53, 0x34, 0x84, 0x54, 0x88, 0x58, 0xd4, 0xe0, 0x7a, 0xd1, 0x3d, 0x11, 0x35, 0xad, + 0xd1, 0xbb, 0x41, 0x0d, 0x07, 0x49, 0xbc, 0x70, 0xf4, 0x42, 0x68, 0x1d, 0x96, 0x86, 0xa5, 0x53, + 0xdb, 0x2e, 0x89, 0x8f, 0xc0, 0x4b, 0xf8, 0x10, 0x3c, 0xa1, 0x81, 0xad, 0x1b, 0x4c, 0x38, 0x35, + 0xfd, 0xe7, 0x9b, 0x7f, 0xfe, 0xfc, 0xf4, 0xd8, 0x59, 0x25, 0x26, 0x19, 0x98, 0xc0, 0xad, 0xc3, + 0x80, 0xec, 0xc0, 0x59, 0x95, 0x5c, 0x66, 0x88, 0x59, 0x0e, 0x62, 0x2b, 0xc9, 0x62, 0x2a, 0x60, + 0x61, 0xc3, 0x77, 0x49, 0x24, 0x2d, 0xb4, 0x41, 0xa3, 0xf1, 0xf1, 0xdb, 0xc9, 0xf5, 0x12, 0xe6, + 0x3a, 0x8c, 0x77, 0x5c, 0xd2, 0x33, 0xda, 0x79, 0x9d, 0x81, 0x9a, 0x0f, 0xcc, 0x44, 0xe6, 0xf0, + 0x39, 0x82, 0xaf, 0x02, 0x7c, 0x48, 0xa7, 0xf4, 0xf4, 0xbf, 0xec, 0x2d, 0x1a, 0x0f, 0xec, 0x9a, + 0x36, 0x1d, 0xe2, 0x62, 0x0c, 0xa5, 0xde, 0x25, 0x57, 0xa4, 0xd7, 0x18, 0x1d, 0x6d, 0xb4, 0x88, + 0xb2, 0x5b, 0x7a, 0x62, 0x0b, 0x99, 0x6b, 0x3f, 0x03, 0x57, 0x71, 0xb5, 0x2d, 0xd7, 0xae, 0x06, + 0x11, 0x7e, 0xf8, 0x21, 0xb4, 0xf5, 0xbc, 0x89, 0xf3, 0x66, 0x02, 0x38, 0x33, 0xc9, 0xd9, 0x3b, + 0x6d, 0xee, 0x5e, 0x66, 0x5d, 0xee, 0xac, 0xe2, 0x7b, 0x32, 0x26, 0x17, 0x7b, 0x26, 0x65, 0xcc, + 0xb4, 0xb1, 0x5e, 0x91, 0xc3, 0x7e, 0xad, 0x47, 0xd8, 0x13, 0xa5, 0x43, 0x94, 0x71, 0x85, 0x35, + 0x79, 0xec, 0x80, 0x0f, 0x51, 0x26, 0xe7, 0xbc, 0x6c, 0x8f, 0xff, 0xb5, 0xc7, 0x07, 0x9b, 0xf6, + 0x52, 0xba, 0x5e, 0x91, 0x7a, 0x9b, 0xf4, 0xc9, 0x3d, 0x79, 0xb9, 0xfb, 0xb8, 0xc9, 0x74, 0x98, + 0x15, 0x92, 0x2b, 0x5c, 0x88, 0xb8, 0x5d, 0xbd, 0x76, 0x9e, 0x09, 0x0f, 0x6e, 0xa9, 0x15, 0x08, + 0x67, 0x95, 0xac, 0x6f, 0x9d, 0x1e, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xda, 0x33, 0x98, 0x4b, + 0xad, 0x01, 0x00, 0x00, }