Skip to content
Snippets Groups Projects
Commit 06ff57f8 authored by Ahmad Sherif's avatar Ahmad Sherif
Browse files

Add CommitDelta RPC to Diff service

parent 1ec5c4d2
No related branches found
No related tags found
1 merge request!19Add CommitDelta RPC to Diff service
Pipeline #
Loading
Loading
@@ -7,6 +7,8 @@ import "shared.proto";
service Diff {
// Returns stream of CommitDiffResponse: 1 per changed file
rpc CommitDiff(CommitDiffRequest) returns (stream CommitDiffResponse) {};
// Return a stream so we can divide the response in chunks of deltas
rpc CommitDelta(CommitDeltaRequest) returns (stream CommitDeltaResponse) {};
}
 
message CommitDiffRequest {
Loading
Loading
@@ -29,3 +31,24 @@ message CommitDiffResponse {
bool binary = 7;
repeated bytes raw_chunks = 8;
}
message CommitDeltaRequest {
Repository repository = 1;
string left_commit_id = 2;
string right_commit_id = 3;
repeated bytes paths = 4;
}
message CommitDelta {
bytes from_path = 1;
bytes to_path = 2;
// Blob ID as returned via `git diff --full-index`
string from_id = 3;
string to_id = 4;
int32 old_mode = 5;
int32 new_mode = 6;
}
message CommitDeltaResponse {
repeated CommitDelta deltas = 1;
}
Loading
Loading
@@ -19,6 +19,9 @@ It has these top-level messages:
CommitIsAncestorResponse
CommitDiffRequest
CommitDiffResponse
CommitDeltaRequest
CommitDelta
CommitDeltaResponse
PostReceiveRequest
PostReceiveResponse
FindDefaultBranchNameRequest
Loading
Loading
Loading
Loading
@@ -140,9 +140,125 @@ func (m *CommitDiffResponse) GetRawChunks() [][]byte {
return nil
}
 
type CommitDeltaRequest struct {
Repository *Repository `protobuf:"bytes,1,opt,name=repository" json:"repository,omitempty"`
LeftCommitId string `protobuf:"bytes,2,opt,name=left_commit_id,json=leftCommitId" json:"left_commit_id,omitempty"`
RightCommitId string `protobuf:"bytes,3,opt,name=right_commit_id,json=rightCommitId" json:"right_commit_id,omitempty"`
Paths [][]byte `protobuf:"bytes,4,rep,name=paths,proto3" json:"paths,omitempty"`
}
func (m *CommitDeltaRequest) Reset() { *m = CommitDeltaRequest{} }
func (m *CommitDeltaRequest) String() string { return proto.CompactTextString(m) }
func (*CommitDeltaRequest) ProtoMessage() {}
func (*CommitDeltaRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} }
func (m *CommitDeltaRequest) GetRepository() *Repository {
if m != nil {
return m.Repository
}
return nil
}
func (m *CommitDeltaRequest) GetLeftCommitId() string {
if m != nil {
return m.LeftCommitId
}
return ""
}
func (m *CommitDeltaRequest) GetRightCommitId() string {
if m != nil {
return m.RightCommitId
}
return ""
}
func (m *CommitDeltaRequest) GetPaths() [][]byte {
if m != nil {
return m.Paths
}
return nil
}
type CommitDelta struct {
FromPath []byte `protobuf:"bytes,1,opt,name=from_path,json=fromPath,proto3" json:"from_path,omitempty"`
ToPath []byte `protobuf:"bytes,2,opt,name=to_path,json=toPath,proto3" json:"to_path,omitempty"`
// Blob ID as returned via `git diff --full-index`
FromId string `protobuf:"bytes,3,opt,name=from_id,json=fromId" json:"from_id,omitempty"`
ToId string `protobuf:"bytes,4,opt,name=to_id,json=toId" json:"to_id,omitempty"`
OldMode int32 `protobuf:"varint,5,opt,name=old_mode,json=oldMode" json:"old_mode,omitempty"`
NewMode int32 `protobuf:"varint,6,opt,name=new_mode,json=newMode" json:"new_mode,omitempty"`
}
func (m *CommitDelta) Reset() { *m = CommitDelta{} }
func (m *CommitDelta) String() string { return proto.CompactTextString(m) }
func (*CommitDelta) ProtoMessage() {}
func (*CommitDelta) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} }
func (m *CommitDelta) GetFromPath() []byte {
if m != nil {
return m.FromPath
}
return nil
}
func (m *CommitDelta) GetToPath() []byte {
if m != nil {
return m.ToPath
}
return nil
}
func (m *CommitDelta) GetFromId() string {
if m != nil {
return m.FromId
}
return ""
}
func (m *CommitDelta) GetToId() string {
if m != nil {
return m.ToId
}
return ""
}
func (m *CommitDelta) GetOldMode() int32 {
if m != nil {
return m.OldMode
}
return 0
}
func (m *CommitDelta) GetNewMode() int32 {
if m != nil {
return m.NewMode
}
return 0
}
type CommitDeltaResponse struct {
Deltas []*CommitDelta `protobuf:"bytes,1,rep,name=deltas" json:"deltas,omitempty"`
}
func (m *CommitDeltaResponse) Reset() { *m = CommitDeltaResponse{} }
func (m *CommitDeltaResponse) String() string { return proto.CompactTextString(m) }
func (*CommitDeltaResponse) ProtoMessage() {}
func (*CommitDeltaResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} }
func (m *CommitDeltaResponse) GetDeltas() []*CommitDelta {
if m != nil {
return m.Deltas
}
return nil
}
func init() {
proto.RegisterType((*CommitDiffRequest)(nil), "gitaly.CommitDiffRequest")
proto.RegisterType((*CommitDiffResponse)(nil), "gitaly.CommitDiffResponse")
proto.RegisterType((*CommitDeltaRequest)(nil), "gitaly.CommitDeltaRequest")
proto.RegisterType((*CommitDelta)(nil), "gitaly.CommitDelta")
proto.RegisterType((*CommitDeltaResponse)(nil), "gitaly.CommitDeltaResponse")
}
 
// Reference imports to suppress errors if they are not otherwise used.
Loading
Loading
@@ -158,6 +274,8 @@ const _ = grpc.SupportPackageIsVersion4
type DiffClient interface {
// Returns stream of CommitDiffResponse: 1 per changed file
CommitDiff(ctx context.Context, in *CommitDiffRequest, opts ...grpc.CallOption) (Diff_CommitDiffClient, error)
// Return a stream so we can divide the response in chunks of deltas
CommitDelta(ctx context.Context, in *CommitDeltaRequest, opts ...grpc.CallOption) (Diff_CommitDeltaClient, error)
}
 
type diffClient struct {
Loading
Loading
@@ -200,11 +318,45 @@ func (x *diffCommitDiffClient) Recv() (*CommitDiffResponse, error) {
return m, nil
}
 
func (c *diffClient) CommitDelta(ctx context.Context, in *CommitDeltaRequest, opts ...grpc.CallOption) (Diff_CommitDeltaClient, error) {
stream, err := grpc.NewClientStream(ctx, &_Diff_serviceDesc.Streams[1], c.cc, "/gitaly.Diff/CommitDelta", opts...)
if err != nil {
return nil, err
}
x := &diffCommitDeltaClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type Diff_CommitDeltaClient interface {
Recv() (*CommitDeltaResponse, error)
grpc.ClientStream
}
type diffCommitDeltaClient struct {
grpc.ClientStream
}
func (x *diffCommitDeltaClient) Recv() (*CommitDeltaResponse, error) {
m := new(CommitDeltaResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// Server API for Diff service
 
type DiffServer interface {
// Returns stream of CommitDiffResponse: 1 per changed file
CommitDiff(*CommitDiffRequest, Diff_CommitDiffServer) error
// Return a stream so we can divide the response in chunks of deltas
CommitDelta(*CommitDeltaRequest, Diff_CommitDeltaServer) error
}
 
func RegisterDiffServer(s *grpc.Server, srv DiffServer) {
Loading
Loading
@@ -232,6 +384,27 @@ func (x *diffCommitDiffServer) Send(m *CommitDiffResponse) error {
return x.ServerStream.SendMsg(m)
}
 
func _Diff_CommitDelta_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(CommitDeltaRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(DiffServer).CommitDelta(m, &diffCommitDeltaServer{stream})
}
type Diff_CommitDeltaServer interface {
Send(*CommitDeltaResponse) error
grpc.ServerStream
}
type diffCommitDeltaServer struct {
grpc.ServerStream
}
func (x *diffCommitDeltaServer) Send(m *CommitDeltaResponse) error {
return x.ServerStream.SendMsg(m)
}
var _Diff_serviceDesc = grpc.ServiceDesc{
ServiceName: "gitaly.Diff",
HandlerType: (*DiffServer)(nil),
Loading
Loading
@@ -242,6 +415,11 @@ var _Diff_serviceDesc = grpc.ServiceDesc{
Handler: _Diff_CommitDiff_Handler,
ServerStreams: true,
},
{
StreamName: "CommitDelta",
Handler: _Diff_CommitDelta_Handler,
ServerStreams: true,
},
},
Metadata: "diff.proto",
}
Loading
Loading
@@ -249,29 +427,33 @@ var _Diff_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("diff.proto", fileDescriptor1) }
 
var fileDescriptor1 = []byte{
// 369 bytes of a gzipped FileDescri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,
// 446 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xd1, 0x8a, 0x13, 0x31,
0x14, 0x86, 0xcd, 0x76, 0x66, 0xda, 0x9e, 0x56, 0xc5, 0x54, 0xd6, 0x6c, 0x17, 0x61, 0x28, 0x22,
0x03, 0x42, 0x91, 0x7a, 0xe3, 0xb5, 0x15, 0xa4, 0x82, 0x20, 0xb9, 0xf1, 0x72, 0xc8, 0x36, 0x99,
0x4e, 0x70, 0x3a, 0x19, 0x93, 0x2c, 0x43, 0x9f, 0xc5, 0x07, 0xf0, 0xc6, 0xd7, 0xf2, 0x3d, 0x24,
0x49, 0x77, 0x3a, 0xbb, 0xf4, 0x01, 0xf6, 0x32, 0xff, 0xf7, 0xe7, 0x24, 0x7f, 0xce, 0x99, 0x01,
0xe0, 0xb2, 0x28, 0x96, 0x8d, 0x56, 0x56, 0xe1, 0x64, 0x27, 0x2d, 0xab, 0x0e, 0xf3, 0xa9, 0x29,
0x99, 0x16, 0x3c, 0xa8, 0x8b, 0x7f, 0x08, 0x5e, 0xac, 0xd5, 0x7e, 0x2f, 0xed, 0x67, 0x59, 0x14,
0x54, 0xfc, 0xba, 0x15, 0xc6, 0xe2, 0x15, 0x80, 0x16, 0x8d, 0x32, 0xd2, 0x2a, 0x7d, 0x20, 0x28,
0x45, 0xd9, 0x64, 0x85, 0x97, 0xa1, 0xc0, 0x92, 0x76, 0x84, 0xf6, 0x5c, 0xf8, 0x0d, 0x3c, 0xab,
0x44, 0x61, 0xf3, 0xad, 0xaf, 0x96, 0x4b, 0x4e, 0x2e, 0x52, 0x94, 0x8d, 0xe9, 0xd4, 0xa9, 0xe1,
0x88, 0x0d, 0xc7, 0x6f, 0xe1, 0xb9, 0x96, 0xbb, 0xb2, 0x6f, 0x1b, 0x78, 0xdb, 0x53, 0x2f, 0x77,
0xbe, 0x8f, 0x40, 0xe4, 0xae, 0x56, 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 0xef, 0x7a, 0x1c, 0xa0,
0x77, 0x90, 0x70, 0x27, 0x18, 0x82, 0xd2, 0x41, 0x36, 0x59, 0xcd, 0xee, 0x1e, 0xb5, 0x6f, 0x3e,
0x5a, 0x56, 0xbf, 0x11, 0x44, 0x6e, 0xfc, 0xf0, 0x17, 0x80, 0xd3, 0x30, 0xe2, 0xab, 0x07, 0x7b,
0x4e, 0x1f, 0xe2, 0x7c, 0x7e, 0x0e, 0x85, 0xa3, 0x17, 0x4f, 0xde, 0x23, 0xfc, 0xf5, 0xfe, 0xf3,
0xcd, 0xcf, 0x9d, 0x7e, 0x2c, 0x75, 0x7d, 0x96, 0x9d, 0x6a, 0xdd, 0x24, 0xfe, 0x8f, 0xf0, 0xe1,
0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa2, 0xc7, 0x4a, 0x51, 0x35, 0x04, 0x00, 0x00,
}
Loading
Loading
@@ -22,9 +22,29 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
optional :binary, :bool, 7
repeated :raw_chunks, :bytes, 8
end
add_message "gitaly.CommitDeltaRequest" do
optional :repository, :message, 1, "gitaly.Repository"
optional :left_commit_id, :string, 2
optional :right_commit_id, :string, 3
repeated :paths, :bytes, 4
end
add_message "gitaly.CommitDelta" do
optional :from_path, :bytes, 1
optional :to_path, :bytes, 2
optional :from_id, :string, 3
optional :to_id, :string, 4
optional :old_mode, :int32, 5
optional :new_mode, :int32, 6
end
add_message "gitaly.CommitDeltaResponse" do
repeated :deltas, :message, 1, "gitaly.CommitDelta"
end
end
 
module Gitaly
CommitDiffRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.CommitDiffRequest").msgclass
CommitDiffResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.CommitDiffResponse").msgclass
CommitDeltaRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.CommitDeltaRequest").msgclass
CommitDelta = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.CommitDelta").msgclass
CommitDeltaResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.CommitDeltaResponse").msgclass
end
Loading
Loading
@@ -16,6 +16,8 @@ module Gitaly
 
# Returns stream of CommitDiffResponse: 1 per changed file
rpc :CommitDiff, CommitDiffRequest, stream(CommitDiffResponse)
# Return a stream so we can divide the response in chunks of deltas
rpc :CommitDelta, CommitDeltaRequest, stream(CommitDeltaResponse)
end
 
Stub = Service.rpc_stub_class
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment