From 55b2fa886c175f993b51eea33f5f80e33be5354b Mon Sep 17 00:00:00 2001 From: Paul Wells Date: Wed, 5 Jun 2024 23:36:55 -0700 Subject: [PATCH] move analytics rpc to common rpc path --- magefile.go | 14 ++++++------ protobufs/rpc/analytics.proto | 4 +--- {livekit/rpc => rpc}/analytics.pb.go | 10 ++++----- {livekit/rpc => rpc}/analytics_grpc.pb.go | 27 ++++++++++------------- 4 files changed, 24 insertions(+), 31 deletions(-) rename {livekit/rpc => rpc}/analytics.pb.go (93%) rename {livekit/rpc => rpc}/analytics_grpc.pb.go (92%) diff --git a/magefile.go b/magefile.go index 2c5ded37..b98b78c7 100644 --- a/magefile.go +++ b/magefile.go @@ -48,17 +48,17 @@ func Proto() error { "livekit_room.proto", "livekit_sip.proto", } - grpcProtoFiles := []string{ + protoFiles := []string{ "livekit_agent.proto", "livekit_analytics.proto", - "rpc/analytics.proto", "livekit_internal.proto", "livekit_models.proto", "livekit_rtc.proto", "livekit_webhook.proto", } - infraProtoFiles := []string{ + grpcProtoFiles := []string{ "infra/link.proto", + "rpc/analytics.proto", } psrpcProtoFiles := []string{ "rpc/agent.proto", @@ -109,7 +109,7 @@ func Proto() error { if err := cmd.Run(); err != nil { return err } - fmt.Println("generating grpc protobuf") + fmt.Println("generating protobuf") args = append([]string{ "--go_out", target, "--go-grpc_out", target, @@ -118,13 +118,13 @@ func Proto() error { "--plugin=go=" + protocGoPath, "--plugin=go-grpc=" + protocGrpcGoPath, "-I=./protobufs", - }, grpcProtoFiles...) + }, protoFiles...) cmd = exec.Command(protoc, args...) connectStd(cmd) if err := cmd.Run(); err != nil { return err } - fmt.Println("generating infra protobuf") + fmt.Println("generating grpc protobuf") args = append([]string{ "--go_out", ".", "--go-grpc_out", ".", @@ -133,7 +133,7 @@ func Proto() error { "--plugin=go=" + protocGoPath, "--plugin=go-grpc=" + protocGrpcGoPath, "-I=./protobufs", - }, infraProtoFiles...) + }, grpcProtoFiles...) cmd = exec.Command(protoc, args...) connectStd(cmd) if err := cmd.Run(); err != nil { diff --git a/protobufs/rpc/analytics.proto b/protobufs/rpc/analytics.proto index 91e0c1e6..1e7645c5 100644 --- a/protobufs/rpc/analytics.proto +++ b/protobufs/rpc/analytics.proto @@ -15,9 +15,7 @@ syntax = "proto3"; package livekit; -option go_package = "github.com/livekit/protocol/livekit/rpc"; -option csharp_namespace = "LiveKit.Proto"; -option ruby_package = "LiveKit::Proto"; +option go_package = "github.com/livekit/protocol/rpc"; import "google/protobuf/empty.proto"; import "livekit_analytics.proto"; diff --git a/livekit/rpc/analytics.pb.go b/rpc/analytics.pb.go similarity index 93% rename from livekit/rpc/analytics.pb.go rename to rpc/analytics.pb.go index 1f37f59a..f18a077c 100644 --- a/livekit/rpc/analytics.pb.go +++ b/rpc/analytics.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.32.0 // protoc v4.23.4 // source: rpc/analytics.proto @@ -58,12 +58,10 @@ var file_rpc_analytics_proto_rawDesc = []byte{ 0x74, 0x65, 0x73, 0x12, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 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, 0x00, 0x28, 0x01, 0x42, 0x4a, 0x5a, 0x27, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x28, 0x01, 0x42, 0x21, 0x5a, 0x1f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, - 0x69, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x6c, 0x69, 0x76, 0x65, - 0x6b, 0x69, 0x74, 0x2f, 0x72, 0x70, 0x63, 0xaa, 0x02, 0x0d, 0x4c, 0x69, 0x76, 0x65, 0x4b, 0x69, - 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0xea, 0x02, 0x0e, 0x4c, 0x69, 0x76, 0x65, 0x4b, 0x69, - 0x74, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x72, 0x70, 0x63, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_rpc_analytics_proto_goTypes = []interface{}{ diff --git a/livekit/rpc/analytics_grpc.pb.go b/rpc/analytics_grpc.pb.go similarity index 92% rename from livekit/rpc/analytics_grpc.pb.go rename to rpc/analytics_grpc.pb.go index ac9fe3c6..4a9e0c77 100644 --- a/livekit/rpc/analytics_grpc.pb.go +++ b/rpc/analytics_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.3.0 // - protoc v4.23.4 // source: rpc/analytics.proto @@ -31,8 +31,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( AnalyticsRecorderService_IngestStats_FullMethodName = "/livekit.AnalyticsRecorderService/IngestStats" @@ -58,12 +58,11 @@ func NewAnalyticsRecorderServiceClient(cc grpc.ClientConnInterface) AnalyticsRec } func (c *analyticsRecorderServiceClient) IngestStats(ctx context.Context, opts ...grpc.CallOption) (AnalyticsRecorderService_IngestStatsClient, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &AnalyticsRecorderService_ServiceDesc.Streams[0], AnalyticsRecorderService_IngestStats_FullMethodName, cOpts...) + stream, err := c.cc.NewStream(ctx, &AnalyticsRecorderService_ServiceDesc.Streams[0], AnalyticsRecorderService_IngestStats_FullMethodName, opts...) if err != nil { return nil, err } - x := &analyticsRecorderServiceIngestStatsClient{ClientStream: stream} + x := &analyticsRecorderServiceIngestStatsClient{stream} return x, nil } @@ -93,12 +92,11 @@ func (x *analyticsRecorderServiceIngestStatsClient) CloseAndRecv() (*emptypb.Emp } func (c *analyticsRecorderServiceClient) IngestEvents(ctx context.Context, opts ...grpc.CallOption) (AnalyticsRecorderService_IngestEventsClient, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &AnalyticsRecorderService_ServiceDesc.Streams[1], AnalyticsRecorderService_IngestEvents_FullMethodName, cOpts...) + stream, err := c.cc.NewStream(ctx, &AnalyticsRecorderService_ServiceDesc.Streams[1], AnalyticsRecorderService_IngestEvents_FullMethodName, opts...) if err != nil { return nil, err } - x := &analyticsRecorderServiceIngestEventsClient{ClientStream: stream} + x := &analyticsRecorderServiceIngestEventsClient{stream} return x, nil } @@ -128,12 +126,11 @@ func (x *analyticsRecorderServiceIngestEventsClient) CloseAndRecv() (*emptypb.Em } func (c *analyticsRecorderServiceClient) IngestNodeRoomStates(ctx context.Context, opts ...grpc.CallOption) (AnalyticsRecorderService_IngestNodeRoomStatesClient, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &AnalyticsRecorderService_ServiceDesc.Streams[2], AnalyticsRecorderService_IngestNodeRoomStates_FullMethodName, cOpts...) + stream, err := c.cc.NewStream(ctx, &AnalyticsRecorderService_ServiceDesc.Streams[2], AnalyticsRecorderService_IngestNodeRoomStates_FullMethodName, opts...) if err != nil { return nil, err } - x := &analyticsRecorderServiceIngestNodeRoomStatesClient{ClientStream: stream} + x := &analyticsRecorderServiceIngestNodeRoomStatesClient{stream} return x, nil } @@ -200,7 +197,7 @@ func RegisterAnalyticsRecorderServiceServer(s grpc.ServiceRegistrar, srv Analyti } func _AnalyticsRecorderService_IngestStats_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AnalyticsRecorderServiceServer).IngestStats(&analyticsRecorderServiceIngestStatsServer{ServerStream: stream}) + return srv.(AnalyticsRecorderServiceServer).IngestStats(&analyticsRecorderServiceIngestStatsServer{stream}) } type AnalyticsRecorderService_IngestStatsServer interface { @@ -226,7 +223,7 @@ func (x *analyticsRecorderServiceIngestStatsServer) Recv() (*livekit.AnalyticsSt } func _AnalyticsRecorderService_IngestEvents_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AnalyticsRecorderServiceServer).IngestEvents(&analyticsRecorderServiceIngestEventsServer{ServerStream: stream}) + return srv.(AnalyticsRecorderServiceServer).IngestEvents(&analyticsRecorderServiceIngestEventsServer{stream}) } type AnalyticsRecorderService_IngestEventsServer interface { @@ -252,7 +249,7 @@ func (x *analyticsRecorderServiceIngestEventsServer) Recv() (*livekit.AnalyticsE } func _AnalyticsRecorderService_IngestNodeRoomStates_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AnalyticsRecorderServiceServer).IngestNodeRoomStates(&analyticsRecorderServiceIngestNodeRoomStatesServer{ServerStream: stream}) + return srv.(AnalyticsRecorderServiceServer).IngestNodeRoomStates(&analyticsRecorderServiceIngestNodeRoomStatesServer{stream}) } type AnalyticsRecorderService_IngestNodeRoomStatesServer interface {