Client-side purge that keeps the last N tags per repository (excluding latest) and deletes older manifests. Uses existing MCR APIs — no new server RPCs needed. Server-side: added updated_at to TagInfo struct and GetRepositoryDetail query so tags can be sorted by recency. Usage: mcrctl purge --keep 3 --dry-run --gc Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
274 lines
11 KiB
Go
274 lines
11 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.6.1
|
|
// - protoc v6.32.1
|
|
// source: mcr/v1/registry.proto
|
|
|
|
package mcrv1
|
|
|
|
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 (
|
|
RegistryService_ListRepositories_FullMethodName = "/mcr.v1.RegistryService/ListRepositories"
|
|
RegistryService_GetRepository_FullMethodName = "/mcr.v1.RegistryService/GetRepository"
|
|
RegistryService_DeleteRepository_FullMethodName = "/mcr.v1.RegistryService/DeleteRepository"
|
|
RegistryService_GarbageCollect_FullMethodName = "/mcr.v1.RegistryService/GarbageCollect"
|
|
RegistryService_GetGCStatus_FullMethodName = "/mcr.v1.RegistryService/GetGCStatus"
|
|
)
|
|
|
|
// RegistryServiceClient is the client API for RegistryService 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 RegistryServiceClient interface {
|
|
ListRepositories(ctx context.Context, in *ListRepositoriesRequest, opts ...grpc.CallOption) (*ListRepositoriesResponse, error)
|
|
GetRepository(ctx context.Context, in *GetRepositoryRequest, opts ...grpc.CallOption) (*GetRepositoryResponse, error)
|
|
DeleteRepository(ctx context.Context, in *DeleteRepositoryRequest, opts ...grpc.CallOption) (*DeleteRepositoryResponse, error)
|
|
GarbageCollect(ctx context.Context, in *GarbageCollectRequest, opts ...grpc.CallOption) (*GarbageCollectResponse, error)
|
|
GetGCStatus(ctx context.Context, in *GetGCStatusRequest, opts ...grpc.CallOption) (*GetGCStatusResponse, error)
|
|
}
|
|
|
|
type registryServiceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewRegistryServiceClient(cc grpc.ClientConnInterface) RegistryServiceClient {
|
|
return ®istryServiceClient{cc}
|
|
}
|
|
|
|
func (c *registryServiceClient) ListRepositories(ctx context.Context, in *ListRepositoriesRequest, opts ...grpc.CallOption) (*ListRepositoriesResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(ListRepositoriesResponse)
|
|
err := c.cc.Invoke(ctx, RegistryService_ListRepositories_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *registryServiceClient) GetRepository(ctx context.Context, in *GetRepositoryRequest, opts ...grpc.CallOption) (*GetRepositoryResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(GetRepositoryResponse)
|
|
err := c.cc.Invoke(ctx, RegistryService_GetRepository_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *registryServiceClient) DeleteRepository(ctx context.Context, in *DeleteRepositoryRequest, opts ...grpc.CallOption) (*DeleteRepositoryResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(DeleteRepositoryResponse)
|
|
err := c.cc.Invoke(ctx, RegistryService_DeleteRepository_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *registryServiceClient) GarbageCollect(ctx context.Context, in *GarbageCollectRequest, opts ...grpc.CallOption) (*GarbageCollectResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(GarbageCollectResponse)
|
|
err := c.cc.Invoke(ctx, RegistryService_GarbageCollect_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *registryServiceClient) GetGCStatus(ctx context.Context, in *GetGCStatusRequest, opts ...grpc.CallOption) (*GetGCStatusResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(GetGCStatusResponse)
|
|
err := c.cc.Invoke(ctx, RegistryService_GetGCStatus_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// RegistryServiceServer is the server API for RegistryService service.
|
|
// All implementations must embed UnimplementedRegistryServiceServer
|
|
// for forward compatibility.
|
|
type RegistryServiceServer interface {
|
|
ListRepositories(context.Context, *ListRepositoriesRequest) (*ListRepositoriesResponse, error)
|
|
GetRepository(context.Context, *GetRepositoryRequest) (*GetRepositoryResponse, error)
|
|
DeleteRepository(context.Context, *DeleteRepositoryRequest) (*DeleteRepositoryResponse, error)
|
|
GarbageCollect(context.Context, *GarbageCollectRequest) (*GarbageCollectResponse, error)
|
|
GetGCStatus(context.Context, *GetGCStatusRequest) (*GetGCStatusResponse, error)
|
|
mustEmbedUnimplementedRegistryServiceServer()
|
|
}
|
|
|
|
// UnimplementedRegistryServiceServer 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 UnimplementedRegistryServiceServer struct{}
|
|
|
|
func (UnimplementedRegistryServiceServer) ListRepositories(context.Context, *ListRepositoriesRequest) (*ListRepositoriesResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method ListRepositories not implemented")
|
|
}
|
|
func (UnimplementedRegistryServiceServer) GetRepository(context.Context, *GetRepositoryRequest) (*GetRepositoryResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method GetRepository not implemented")
|
|
}
|
|
func (UnimplementedRegistryServiceServer) DeleteRepository(context.Context, *DeleteRepositoryRequest) (*DeleteRepositoryResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method DeleteRepository not implemented")
|
|
}
|
|
func (UnimplementedRegistryServiceServer) GarbageCollect(context.Context, *GarbageCollectRequest) (*GarbageCollectResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method GarbageCollect not implemented")
|
|
}
|
|
func (UnimplementedRegistryServiceServer) GetGCStatus(context.Context, *GetGCStatusRequest) (*GetGCStatusResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method GetGCStatus not implemented")
|
|
}
|
|
func (UnimplementedRegistryServiceServer) mustEmbedUnimplementedRegistryServiceServer() {}
|
|
func (UnimplementedRegistryServiceServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeRegistryServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to RegistryServiceServer will
|
|
// result in compilation errors.
|
|
type UnsafeRegistryServiceServer interface {
|
|
mustEmbedUnimplementedRegistryServiceServer()
|
|
}
|
|
|
|
func RegisterRegistryServiceServer(s grpc.ServiceRegistrar, srv RegistryServiceServer) {
|
|
// If the following call panics, it indicates UnimplementedRegistryServiceServer 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(&RegistryService_ServiceDesc, srv)
|
|
}
|
|
|
|
func _RegistryService_ListRepositories_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ListRepositoriesRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(RegistryServiceServer).ListRepositories(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: RegistryService_ListRepositories_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(RegistryServiceServer).ListRepositories(ctx, req.(*ListRepositoriesRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _RegistryService_GetRepository_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(GetRepositoryRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(RegistryServiceServer).GetRepository(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: RegistryService_GetRepository_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(RegistryServiceServer).GetRepository(ctx, req.(*GetRepositoryRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _RegistryService_DeleteRepository_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(DeleteRepositoryRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(RegistryServiceServer).DeleteRepository(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: RegistryService_DeleteRepository_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(RegistryServiceServer).DeleteRepository(ctx, req.(*DeleteRepositoryRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _RegistryService_GarbageCollect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(GarbageCollectRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(RegistryServiceServer).GarbageCollect(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: RegistryService_GarbageCollect_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(RegistryServiceServer).GarbageCollect(ctx, req.(*GarbageCollectRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _RegistryService_GetGCStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(GetGCStatusRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(RegistryServiceServer).GetGCStatus(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: RegistryService_GetGCStatus_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(RegistryServiceServer).GetGCStatus(ctx, req.(*GetGCStatusRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// RegistryService_ServiceDesc is the grpc.ServiceDesc for RegistryService service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var RegistryService_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "mcr.v1.RegistryService",
|
|
HandlerType: (*RegistryServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "ListRepositories",
|
|
Handler: _RegistryService_ListRepositories_Handler,
|
|
},
|
|
{
|
|
MethodName: "GetRepository",
|
|
Handler: _RegistryService_GetRepository_Handler,
|
|
},
|
|
{
|
|
MethodName: "DeleteRepository",
|
|
Handler: _RegistryService_DeleteRepository_Handler,
|
|
},
|
|
{
|
|
MethodName: "GarbageCollect",
|
|
Handler: _RegistryService_GarbageCollect_Handler,
|
|
},
|
|
{
|
|
MethodName: "GetGCStatus",
|
|
Handler: _RegistryService_GetGCStatus_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "mcr/v1/registry.proto",
|
|
}
|