Skip to content

Git designed for AI agents.

9.2 KB
Raw Blame
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc             v6.30.2
// source: object.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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	ObjectService_GetObjects_FullMethodName = "/gitaly.ObjectService/GetObjects"
	ObjectService_GetTree_FullMethodName    = "/gitaly.ObjectService/GetTree"
)

// ObjectServiceClient is the client API for ObjectService 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.
//
// ObjectService provides on-demand, content-addressed access to Git objects.
//
// It is designed for always-online clients (agents, CI jobs, sparse working
// copies and cache tiers) that fetch exactly the trees and blobs they need
// instead of negotiating packfiles. Objects are immutable, so every response
// of this service is cacheable forever by object ID.
type ObjectServiceClient interface {
	// GetObjects streams the raw contents of the requested objects. Objects are
	// returned in request order. Large objects are split across several
	// messages: the first message of an object carries oid, type and size, and
	// every message carries the next chunk of data at the given offset. Objects
	// that do not exist are reported with `missing = true` and no data, so a
	// single RPC never fails because of one absent object.
	//
	// Transfers are resumable: a client that lost the stream re-issues the
	// request with the not-yet-completed object IDs, passing the partially
	// received object as resume_oid together with resume_offset.
	GetObjects(ctx context.Context, in *GetObjectsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetObjectsResponse], error)
	// GetTree lists the entries of a tree, optionally recursively, in a
	// stable order (depth-first, entries sorted by path). The tree is selected
	// either by tree_oid or by revision plus path.
	GetTree(ctx context.Context, in *GetTreeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetTreeResponse], error)
}

type objectServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewObjectServiceClient(cc grpc.ClientConnInterface) ObjectServiceClient {
	return &objectServiceClient{cc}
}

func (c *objectServiceClient) GetObjects(ctx context.Context, in *GetObjectsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetObjectsResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[0], ObjectService_GetObjects_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[GetObjectsRequest, GetObjectsResponse]{ClientStream: 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
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ObjectService_GetObjectsClient = grpc.ServerStreamingClient[GetObjectsResponse]

func (c *objectServiceClient) GetTree(ctx context.Context, in *GetTreeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetTreeResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[1], ObjectService_GetTree_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[GetTreeRequest, GetTreeResponse]{ClientStream: 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
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ObjectService_GetTreeClient = grpc.ServerStreamingClient[GetTreeResponse]

// ObjectServiceServer is the server API for ObjectService service.
// All implementations must embed UnimplementedObjectServiceServer
// for forward compatibility.
//
// ObjectService provides on-demand, content-addressed access to Git objects.
//
// It is designed for always-online clients (agents, CI jobs, sparse working
// copies and cache tiers) that fetch exactly the trees and blobs they need
// instead of negotiating packfiles. Objects are immutable, so every response
// of this service is cacheable forever by object ID.
type ObjectServiceServer interface {
	// GetObjects streams the raw contents of the requested objects. Objects are
	// returned in request order. Large objects are split across several
	// messages: the first message of an object carries oid, type and size, and
	// every message carries the next chunk of data at the given offset. Objects
	// that do not exist are reported with `missing = true` and no data, so a
	// single RPC never fails because of one absent object.
	//
	// Transfers are resumable: a client that lost the stream re-issues the
	// request with the not-yet-completed object IDs, passing the partially
	// received object as resume_oid together with resume_offset.
	GetObjects(*GetObjectsRequest, grpc.ServerStreamingServer[GetObjectsResponse]) error
	// GetTree lists the entries of a tree, optionally recursively, in a
	// stable order (depth-first, entries sorted by path). The tree is selected
	// either by tree_oid or by revision plus path.
	GetTree(*GetTreeRequest, grpc.ServerStreamingServer[GetTreeResponse]) error
	mustEmbedUnimplementedObjectServiceServer()
}

// UnimplementedObjectServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedObjectServiceServer struct{}

func (UnimplementedObjectServiceServer) GetObjects(*GetObjectsRequest, grpc.ServerStreamingServer[GetObjectsResponse]) error {
	return status.Error(codes.Unimplemented, "method GetObjects not implemented")
}
func (UnimplementedObjectServiceServer) GetTree(*GetTreeRequest, grpc.ServerStreamingServer[GetTreeResponse]) error {
	return status.Error(codes.Unimplemented, "method GetTree not implemented")
}
func (UnimplementedObjectServiceServer) mustEmbedUnimplementedObjectServiceServer() {}
func (UnimplementedObjectServiceServer) testEmbeddedByValue()                       {}

// UnsafeObjectServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ObjectServiceServer will
// result in compilation errors.
type UnsafeObjectServiceServer interface {
	mustEmbedUnimplementedObjectServiceServer()
}

func RegisterObjectServiceServer(s grpc.ServiceRegistrar, srv ObjectServiceServer) {
	// If the following call panics, it indicates UnimplementedObjectServiceServer was
	// embedded by pointer and is nil.  This will cause panics if an
	// unimplemented method is ever invoked, so we test this at initialization
	// time to prevent it from happening at runtime later due to I/O.
	if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
		t.testEmbeddedByValue()
	}
	s.RegisterService(&ObjectService_ServiceDesc, srv)
}

func _ObjectService_GetObjects_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(GetObjectsRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ObjectServiceServer).GetObjects(m, &grpc.GenericServerStream[GetObjectsRequest, GetObjectsResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ObjectService_GetObjectsServer = grpc.ServerStreamingServer[GetObjectsResponse]

func _ObjectService_GetTree_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(GetTreeRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ObjectServiceServer).GetTree(m, &grpc.GenericServerStream[GetTreeRequest, GetTreeResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ObjectService_GetTreeServer = grpc.ServerStreamingServer[GetTreeResponse]

// ObjectService_ServiceDesc is the grpc.ServiceDesc for ObjectService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ObjectService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gitaly.ObjectService",
	HandlerType: (*ObjectServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "GetObjects",
			Handler:       _ObjectService_GetObjects_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "GetTree",
			Handler:       _ObjectService_GetTree_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "object.proto",
}