From 41a67fb9185c6a842decc22bb917d65f2ca1d6ff Mon Sep 17 00:00:00 2001 From: Justin Tobler Date: Thu, 30 Nov 2023 09:57:42 -0600 Subject: proto: Define `CheckBlobsGenerated` RPC In certain scenarios it is useful for clients to have insight regarding whether a particular file in a repository is generated. For example, in the context of rendering diffs, generated files may not be desired. To accommodate this, a new `CheckBlobsGenerated` RPC is defined. A new `AnalysisService` gRPC service is also defined which contains the RPC. --- proto/analysis.proto | 62 ++++++ proto/go/gitalypb/analysis.pb.go | 403 ++++++++++++++++++++++++++++++++++ proto/go/gitalypb/analysis_grpc.pb.go | 155 +++++++++++++ proto/go/gitalypb/protolist.go | 1 + 4 files changed, 621 insertions(+) create mode 100644 proto/analysis.proto create mode 100644 proto/go/gitalypb/analysis.pb.go create mode 100644 proto/go/gitalypb/analysis_grpc.pb.go (limited to 'proto') diff --git a/proto/analysis.proto b/proto/analysis.proto new file mode 100644 index 000000000..ced5b9cb9 --- /dev/null +++ b/proto/analysis.proto @@ -0,0 +1,62 @@ +syntax = "proto3"; + +package gitaly; + +import "lint.proto"; +import "shared.proto"; + +option go_package = "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb"; + +// AnalysisService is a gRPC service providing RPCs that analyze objects in a repository. +service AnalysisService { + + // CheckBlobsGenerated checks a provided set of blobs in a specified repository to determine + // whether the file is considered generated. This RPC supports bidirectional streaming because the + // client may specify any number of files to check across multiple request messages and the server + // responds to each request with a separate set of response messages. + // + // Each provided blob in the request is validated when received. Improperly formatted requests + // result in RPC termination and an error being returned to the client. The RPC also aborts and + // returns an error if requests are made that list Git revisions which do not resolve to a blob + // and/or cannot be found in the repository. + rpc CheckBlobsGenerated(stream CheckBlobsGeneratedRequest) returns (stream CheckBlobsGeneratedResponse) { + option (op_type) = { + op: ACCESSOR + }; + } +} + +// CheckBlobsGeneratedRequest is a request for the CheckBlobsGenerated RPC. The client may send +// multiple requests through the stream to check multiple sets of files. The first request must have +// the repository field set. Every request, including the first, must contain a blob set with at +// least a single entry. +message CheckBlobsGeneratedRequest { + // Blob defines the required information to determine if a blob is generated. + message Blob { + // revision is a Git revision that resolves to a blob. + bytes revision = 1; + // path is the file path of the blob and is used to gain insight as to whether the blob is + // generated. + bytes path = 2; + } + + // repository is the repository that generated files are being checked for. + Repository repository = 1 [(target_repository)=true]; + // blobs is a set of blobs that the generated file check is being performed on. + repeated Blob blobs = 2; +} + +// CheckBlobsGeneratedResponse is a response for the CheckBlobsGenerated RPC. If the client sends +// multiple requests, the server responds with a separate response message for each request. +message CheckBlobsGeneratedResponse { + // Blob defines the status of the generated blob check for a revision. + message Blob { + // revision is the Git revision of the checked blob provided in the request. + bytes revision = 1; + // generated is the result of the file generation check for a particular blob. + bool generated = 2; + } + + // blobs is a set of blobs that the generated file check has been performed on. + repeated Blob blobs = 1; +} diff --git a/proto/go/gitalypb/analysis.pb.go b/proto/go/gitalypb/analysis.pb.go new file mode 100644 index 000000000..d19efdc18 --- /dev/null +++ b/proto/go/gitalypb/analysis.pb.go @@ -0,0 +1,403 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.23.1 +// source: analysis.proto + +package gitalypb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +// CheckBlobsGeneratedRequest is a request for the CheckBlobsGenerated RPC. The client may send +// multiple requests through the stream to check multiple sets of files. The first request must have +// the repository field set. Every request, including the first, must contain a blob set with at +// least a single entry. +type CheckBlobsGeneratedRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // repository is the repository that generated files are being checked for. + Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"` + // blobs is a set of blobs that the generated file check is being performed on. + Blobs []*CheckBlobsGeneratedRequest_Blob `protobuf:"bytes,2,rep,name=blobs,proto3" json:"blobs,omitempty"` +} + +func (x *CheckBlobsGeneratedRequest) Reset() { + *x = CheckBlobsGeneratedRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_analysis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CheckBlobsGeneratedRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckBlobsGeneratedRequest) ProtoMessage() {} + +func (x *CheckBlobsGeneratedRequest) ProtoReflect() protoreflect.Message { + mi := &file_analysis_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 CheckBlobsGeneratedRequest.ProtoReflect.Descriptor instead. +func (*CheckBlobsGeneratedRequest) Descriptor() ([]byte, []int) { + return file_analysis_proto_rawDescGZIP(), []int{0} +} + +func (x *CheckBlobsGeneratedRequest) GetRepository() *Repository { + if x != nil { + return x.Repository + } + return nil +} + +func (x *CheckBlobsGeneratedRequest) GetBlobs() []*CheckBlobsGeneratedRequest_Blob { + if x != nil { + return x.Blobs + } + return nil +} + +// CheckBlobsGeneratedResponse is a response for the CheckBlobsGenerated RPC. If the client sends +// multiple requests, the server responds with a separate response message for each request. +type CheckBlobsGeneratedResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // blobs is a set of blobs that the generated file check has been performed on. + Blobs []*CheckBlobsGeneratedResponse_Blob `protobuf:"bytes,1,rep,name=blobs,proto3" json:"blobs,omitempty"` +} + +func (x *CheckBlobsGeneratedResponse) Reset() { + *x = CheckBlobsGeneratedResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_analysis_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CheckBlobsGeneratedResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckBlobsGeneratedResponse) ProtoMessage() {} + +func (x *CheckBlobsGeneratedResponse) ProtoReflect() protoreflect.Message { + mi := &file_analysis_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 CheckBlobsGeneratedResponse.ProtoReflect.Descriptor instead. +func (*CheckBlobsGeneratedResponse) Descriptor() ([]byte, []int) { + return file_analysis_proto_rawDescGZIP(), []int{1} +} + +func (x *CheckBlobsGeneratedResponse) GetBlobs() []*CheckBlobsGeneratedResponse_Blob { + if x != nil { + return x.Blobs + } + return nil +} + +// Blob defines the required information to determine if a blob is generated. +type CheckBlobsGeneratedRequest_Blob struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // revision is a Git revision that resolves to a blob. + Revision []byte `protobuf:"bytes,1,opt,name=revision,proto3" json:"revision,omitempty"` + // path is the file path of the blob and is used to gain insight as to whether the blob is + // generated. + Path []byte `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` +} + +func (x *CheckBlobsGeneratedRequest_Blob) Reset() { + *x = CheckBlobsGeneratedRequest_Blob{} + if protoimpl.UnsafeEnabled { + mi := &file_analysis_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CheckBlobsGeneratedRequest_Blob) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckBlobsGeneratedRequest_Blob) ProtoMessage() {} + +func (x *CheckBlobsGeneratedRequest_Blob) ProtoReflect() protoreflect.Message { + mi := &file_analysis_proto_msgTypes[2] + 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 CheckBlobsGeneratedRequest_Blob.ProtoReflect.Descriptor instead. +func (*CheckBlobsGeneratedRequest_Blob) Descriptor() ([]byte, []int) { + return file_analysis_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *CheckBlobsGeneratedRequest_Blob) GetRevision() []byte { + if x != nil { + return x.Revision + } + return nil +} + +func (x *CheckBlobsGeneratedRequest_Blob) GetPath() []byte { + if x != nil { + return x.Path + } + return nil +} + +// Blob defines the status of the generated blob check for a revision. +type CheckBlobsGeneratedResponse_Blob struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // revision is the Git revision of the checked blob provided in the request. + Revision []byte `protobuf:"bytes,1,opt,name=revision,proto3" json:"revision,omitempty"` + // generated is the result of the file generation check for a particular blob. + Generated bool `protobuf:"varint,2,opt,name=generated,proto3" json:"generated,omitempty"` +} + +func (x *CheckBlobsGeneratedResponse_Blob) Reset() { + *x = CheckBlobsGeneratedResponse_Blob{} + if protoimpl.UnsafeEnabled { + mi := &file_analysis_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CheckBlobsGeneratedResponse_Blob) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckBlobsGeneratedResponse_Blob) ProtoMessage() {} + +func (x *CheckBlobsGeneratedResponse_Blob) ProtoReflect() protoreflect.Message { + mi := &file_analysis_proto_msgTypes[3] + 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 CheckBlobsGeneratedResponse_Blob.ProtoReflect.Descriptor instead. +func (*CheckBlobsGeneratedResponse_Blob) Descriptor() ([]byte, []int) { + return file_analysis_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *CheckBlobsGeneratedResponse_Blob) GetRevision() []byte { + if x != nil { + return x.Revision + } + return nil +} + +func (x *CheckBlobsGeneratedResponse_Blob) GetGenerated() bool { + if x != nil { + return x.Generated + } + return false +} + +var File_analysis_proto protoreflect.FileDescriptor + +var file_analysis_proto_rawDesc = []byte{ + 0x0a, 0x0e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x06, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x1a, 0x0a, 0x6c, 0x69, 0x6e, 0x74, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xcd, 0x01, 0x0a, 0x1a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x6c, 0x6f, 0x62, + 0x73, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x38, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x04, 0x98, 0xc6, 0x2c, 0x01, 0x52, + 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x3d, 0x0a, 0x05, 0x62, + 0x6c, 0x6f, 0x62, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x67, 0x69, 0x74, + 0x61, 0x6c, 0x79, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x6c, 0x6f, 0x62, 0x73, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, + 0x6c, 0x6f, 0x62, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x62, 0x73, 0x1a, 0x36, 0x0a, 0x04, 0x42, 0x6c, + 0x6f, 0x62, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, + 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x22, 0x9f, 0x01, 0x0a, 0x1b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x6c, 0x6f, 0x62, + 0x73, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x62, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x42, 0x6c, 0x6f, 0x62, 0x73, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x05, 0x62, 0x6c, 0x6f, + 0x62, 0x73, 0x1a, 0x40, 0x0a, 0x04, 0x42, 0x6c, 0x6f, 0x62, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x32, 0x7d, 0x0a, 0x0f, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6a, 0x0a, 0x13, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x42, 0x6c, 0x6f, 0x62, 0x73, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x12, 0x22, + 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x6c, 0x6f, + 0x62, 0x73, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x42, 0x6c, 0x6f, 0x62, 0x73, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x02, 0x28, + 0x01, 0x30, 0x01, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x69, 0x74, + 0x61, 0x6c, 0x79, 0x2f, 0x76, 0x31, 0x36, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, + 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_analysis_proto_rawDescOnce sync.Once + file_analysis_proto_rawDescData = file_analysis_proto_rawDesc +) + +func file_analysis_proto_rawDescGZIP() []byte { + file_analysis_proto_rawDescOnce.Do(func() { + file_analysis_proto_rawDescData = protoimpl.X.CompressGZIP(file_analysis_proto_rawDescData) + }) + return file_analysis_proto_rawDescData +} + +var file_analysis_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_analysis_proto_goTypes = []interface{}{ + (*CheckBlobsGeneratedRequest)(nil), // 0: gitaly.CheckBlobsGeneratedRequest + (*CheckBlobsGeneratedResponse)(nil), // 1: gitaly.CheckBlobsGeneratedResponse + (*CheckBlobsGeneratedRequest_Blob)(nil), // 2: gitaly.CheckBlobsGeneratedRequest.Blob + (*CheckBlobsGeneratedResponse_Blob)(nil), // 3: gitaly.CheckBlobsGeneratedResponse.Blob + (*Repository)(nil), // 4: gitaly.Repository +} +var file_analysis_proto_depIdxs = []int32{ + 4, // 0: gitaly.CheckBlobsGeneratedRequest.repository:type_name -> gitaly.Repository + 2, // 1: gitaly.CheckBlobsGeneratedRequest.blobs:type_name -> gitaly.CheckBlobsGeneratedRequest.Blob + 3, // 2: gitaly.CheckBlobsGeneratedResponse.blobs:type_name -> gitaly.CheckBlobsGeneratedResponse.Blob + 0, // 3: gitaly.AnalysisService.CheckBlobsGenerated:input_type -> gitaly.CheckBlobsGeneratedRequest + 1, // 4: gitaly.AnalysisService.CheckBlobsGenerated:output_type -> gitaly.CheckBlobsGeneratedResponse + 4, // [4:5] is the sub-list for method output_type + 3, // [3:4] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_analysis_proto_init() } +func file_analysis_proto_init() { + if File_analysis_proto != nil { + return + } + file_lint_proto_init() + file_shared_proto_init() + if !protoimpl.UnsafeEnabled { + file_analysis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CheckBlobsGeneratedRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_analysis_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CheckBlobsGeneratedResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_analysis_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CheckBlobsGeneratedRequest_Blob); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_analysis_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CheckBlobsGeneratedResponse_Blob); 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_analysis_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_analysis_proto_goTypes, + DependencyIndexes: file_analysis_proto_depIdxs, + MessageInfos: file_analysis_proto_msgTypes, + }.Build() + File_analysis_proto = out.File + file_analysis_proto_rawDesc = nil + file_analysis_proto_goTypes = nil + file_analysis_proto_depIdxs = nil +} diff --git a/proto/go/gitalypb/analysis_grpc.pb.go b/proto/go/gitalypb/analysis_grpc.pb.go new file mode 100644 index 000000000..04055e50e --- /dev/null +++ b/proto/go/gitalypb/analysis_grpc.pb.go @@ -0,0 +1,155 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v4.23.1 +// source: analysis.proto + +package gitalypb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// 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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// AnalysisServiceClient is the client API for AnalysisService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type AnalysisServiceClient interface { + // CheckBlobsGenerated checks a provided set of blobs in a specified repository to determine + // whether the file is considered generated. This RPC supports bidirectional streaming because the + // client may specify any number of files to check across multiple request messages and the server + // responds to each request with a separate set of response messages. + // + // Each provided blob in the request is validated when received. Improperly formatted requests + // result in RPC termination and an error being returned to the client. The RPC also aborts and + // returns an error if requests are made that list Git revisions which do not resolve to a blob + // and/or cannot be found in the repository. + CheckBlobsGenerated(ctx context.Context, opts ...grpc.CallOption) (AnalysisService_CheckBlobsGeneratedClient, error) +} + +type analysisServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAnalysisServiceClient(cc grpc.ClientConnInterface) AnalysisServiceClient { + return &analysisServiceClient{cc} +} + +func (c *analysisServiceClient) CheckBlobsGenerated(ctx context.Context, opts ...grpc.CallOption) (AnalysisService_CheckBlobsGeneratedClient, error) { + stream, err := c.cc.NewStream(ctx, &AnalysisService_ServiceDesc.Streams[0], "/gitaly.AnalysisService/CheckBlobsGenerated", opts...) + if err != nil { + return nil, err + } + x := &analysisServiceCheckBlobsGeneratedClient{stream} + return x, nil +} + +type AnalysisService_CheckBlobsGeneratedClient interface { + Send(*CheckBlobsGeneratedRequest) error + Recv() (*CheckBlobsGeneratedResponse, error) + grpc.ClientStream +} + +type analysisServiceCheckBlobsGeneratedClient struct { + grpc.ClientStream +} + +func (x *analysisServiceCheckBlobsGeneratedClient) Send(m *CheckBlobsGeneratedRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *analysisServiceCheckBlobsGeneratedClient) Recv() (*CheckBlobsGeneratedResponse, error) { + m := new(CheckBlobsGeneratedResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// AnalysisServiceServer is the server API for AnalysisService service. +// All implementations must embed UnimplementedAnalysisServiceServer +// for forward compatibility +type AnalysisServiceServer interface { + // CheckBlobsGenerated checks a provided set of blobs in a specified repository to determine + // whether the file is considered generated. This RPC supports bidirectional streaming because the + // client may specify any number of files to check across multiple request messages and the server + // responds to each request with a separate set of response messages. + // + // Each provided blob in the request is validated when received. Improperly formatted requests + // result in RPC termination and an error being returned to the client. The RPC also aborts and + // returns an error if requests are made that list Git revisions which do not resolve to a blob + // and/or cannot be found in the repository. + CheckBlobsGenerated(AnalysisService_CheckBlobsGeneratedServer) error + mustEmbedUnimplementedAnalysisServiceServer() +} + +// UnimplementedAnalysisServiceServer must be embedded to have forward compatible implementations. +type UnimplementedAnalysisServiceServer struct { +} + +func (UnimplementedAnalysisServiceServer) CheckBlobsGenerated(AnalysisService_CheckBlobsGeneratedServer) error { + return status.Errorf(codes.Unimplemented, "method CheckBlobsGenerated not implemented") +} +func (UnimplementedAnalysisServiceServer) mustEmbedUnimplementedAnalysisServiceServer() {} + +// UnsafeAnalysisServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AnalysisServiceServer will +// result in compilation errors. +type UnsafeAnalysisServiceServer interface { + mustEmbedUnimplementedAnalysisServiceServer() +} + +func RegisterAnalysisServiceServer(s grpc.ServiceRegistrar, srv AnalysisServiceServer) { + s.RegisterService(&AnalysisService_ServiceDesc, srv) +} + +func _AnalysisService_CheckBlobsGenerated_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(AnalysisServiceServer).CheckBlobsGenerated(&analysisServiceCheckBlobsGeneratedServer{stream}) +} + +type AnalysisService_CheckBlobsGeneratedServer interface { + Send(*CheckBlobsGeneratedResponse) error + Recv() (*CheckBlobsGeneratedRequest, error) + grpc.ServerStream +} + +type analysisServiceCheckBlobsGeneratedServer struct { + grpc.ServerStream +} + +func (x *analysisServiceCheckBlobsGeneratedServer) Send(m *CheckBlobsGeneratedResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *analysisServiceCheckBlobsGeneratedServer) Recv() (*CheckBlobsGeneratedRequest, error) { + m := new(CheckBlobsGeneratedRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// AnalysisService_ServiceDesc is the grpc.ServiceDesc for AnalysisService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AnalysisService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gitaly.AnalysisService", + HandlerType: (*AnalysisServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "CheckBlobsGenerated", + Handler: _AnalysisService_CheckBlobsGenerated_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "analysis.proto", +} diff --git a/proto/go/gitalypb/protolist.go b/proto/go/gitalypb/protolist.go index 30e8c28a3..b7e92510a 100644 --- a/proto/go/gitalypb/protolist.go +++ b/proto/go/gitalypb/protolist.go @@ -4,6 +4,7 @@ package gitalypb // GitalyProtos is a list of gitaly protobuf files var GitalyProtos = []string{ + "analysis.proto", "blob.proto", "cleanup.proto", "commit.proto", -- cgit v1.2.3