refactor(tvix): move castore into tvix-castore crate
This splits the pure content-addressed layers from tvix-store into a `castore` crate, and only leaves PathInfo related things, as well as the CLI entrypoint in the tvix-store crate. Notable changes: - `fixtures` and `utils` had to be moved out of the `test` cfg, so they can be imported from tvix-store. - Some ad-hoc fixtures in the test were moved to proper fixtures in the same step. - The protos are now created by a (more static) recipe in the protos/ directory. The (now two) golang targets are commented out, as it's not possible to update them properly in the same CL. This will be done by a followup CL once this is merged (and whitby deployed) Bug: https://b.tvl.fyi/issues/301 Change-Id: I8d675d4bf1fb697eb7d479747c1b1e3635718107 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9370 Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: Connor Brewster <cbrewster@hey.com>
This commit is contained in:
parent
d8ef0cfb4a
commit
32f41458c0
89 changed files with 2308 additions and 1829 deletions
238
tvix/castore/protos/rpc_directory_grpc.pb.go
Normal file
238
tvix/castore/protos/rpc_directory_grpc.pb.go
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
// Copyright © 2022 The Tvix Authors
|
||||
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.3.0
|
||||
// - protoc (unknown)
|
||||
// source: tvix/castore/protos/rpc_directory.proto
|
||||
|
||||
package castorev1
|
||||
|
||||
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
|
||||
|
||||
const (
|
||||
DirectoryService_Get_FullMethodName = "/tvix.castore.v1.DirectoryService/Get"
|
||||
DirectoryService_Put_FullMethodName = "/tvix.castore.v1.DirectoryService/Put"
|
||||
)
|
||||
|
||||
// DirectoryServiceClient is the client API for DirectoryService 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 DirectoryServiceClient interface {
|
||||
// Get retrieves a stream of Directory messages, by using the lookup
|
||||
// parameters in GetDirectoryRequest.
|
||||
// Keep in mind multiple DirectoryNodes in different parts of the graph might
|
||||
// have the same digest if they have the same underlying contents,
|
||||
// so sending subsequent ones can be omitted.
|
||||
Get(ctx context.Context, in *GetDirectoryRequest, opts ...grpc.CallOption) (DirectoryService_GetClient, error)
|
||||
// Put uploads a graph of Directory messages.
|
||||
// Individual Directory messages need to be send in an order walking up
|
||||
// from the leaves to the root - a Directory message can only refer to
|
||||
// Directory messages previously sent in the same stream.
|
||||
// Keep in mind multiple DirectoryNodes in different parts of the graph might
|
||||
// have the same digest if they have the same underlying contents,
|
||||
// so sending subsequent ones can be omitted.
|
||||
// We might add a separate method, allowing to send partial graphs at a later
|
||||
// time, if requiring to send the full graph turns out to be a problem.
|
||||
Put(ctx context.Context, opts ...grpc.CallOption) (DirectoryService_PutClient, error)
|
||||
}
|
||||
|
||||
type directoryServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewDirectoryServiceClient(cc grpc.ClientConnInterface) DirectoryServiceClient {
|
||||
return &directoryServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *directoryServiceClient) Get(ctx context.Context, in *GetDirectoryRequest, opts ...grpc.CallOption) (DirectoryService_GetClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &DirectoryService_ServiceDesc.Streams[0], DirectoryService_Get_FullMethodName, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &directoryServiceGetClient{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 DirectoryService_GetClient interface {
|
||||
Recv() (*Directory, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type directoryServiceGetClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *directoryServiceGetClient) Recv() (*Directory, error) {
|
||||
m := new(Directory)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *directoryServiceClient) Put(ctx context.Context, opts ...grpc.CallOption) (DirectoryService_PutClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &DirectoryService_ServiceDesc.Streams[1], DirectoryService_Put_FullMethodName, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &directoryServicePutClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type DirectoryService_PutClient interface {
|
||||
Send(*Directory) error
|
||||
CloseAndRecv() (*PutDirectoryResponse, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type directoryServicePutClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *directoryServicePutClient) Send(m *Directory) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *directoryServicePutClient) CloseAndRecv() (*PutDirectoryResponse, error) {
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m := new(PutDirectoryResponse)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// DirectoryServiceServer is the server API for DirectoryService service.
|
||||
// All implementations must embed UnimplementedDirectoryServiceServer
|
||||
// for forward compatibility
|
||||
type DirectoryServiceServer interface {
|
||||
// Get retrieves a stream of Directory messages, by using the lookup
|
||||
// parameters in GetDirectoryRequest.
|
||||
// Keep in mind multiple DirectoryNodes in different parts of the graph might
|
||||
// have the same digest if they have the same underlying contents,
|
||||
// so sending subsequent ones can be omitted.
|
||||
Get(*GetDirectoryRequest, DirectoryService_GetServer) error
|
||||
// Put uploads a graph of Directory messages.
|
||||
// Individual Directory messages need to be send in an order walking up
|
||||
// from the leaves to the root - a Directory message can only refer to
|
||||
// Directory messages previously sent in the same stream.
|
||||
// Keep in mind multiple DirectoryNodes in different parts of the graph might
|
||||
// have the same digest if they have the same underlying contents,
|
||||
// so sending subsequent ones can be omitted.
|
||||
// We might add a separate method, allowing to send partial graphs at a later
|
||||
// time, if requiring to send the full graph turns out to be a problem.
|
||||
Put(DirectoryService_PutServer) error
|
||||
mustEmbedUnimplementedDirectoryServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedDirectoryServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedDirectoryServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedDirectoryServiceServer) Get(*GetDirectoryRequest, DirectoryService_GetServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method Get not implemented")
|
||||
}
|
||||
func (UnimplementedDirectoryServiceServer) Put(DirectoryService_PutServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method Put not implemented")
|
||||
}
|
||||
func (UnimplementedDirectoryServiceServer) mustEmbedUnimplementedDirectoryServiceServer() {}
|
||||
|
||||
// UnsafeDirectoryServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to DirectoryServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeDirectoryServiceServer interface {
|
||||
mustEmbedUnimplementedDirectoryServiceServer()
|
||||
}
|
||||
|
||||
func RegisterDirectoryServiceServer(s grpc.ServiceRegistrar, srv DirectoryServiceServer) {
|
||||
s.RegisterService(&DirectoryService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _DirectoryService_Get_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(GetDirectoryRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(DirectoryServiceServer).Get(m, &directoryServiceGetServer{stream})
|
||||
}
|
||||
|
||||
type DirectoryService_GetServer interface {
|
||||
Send(*Directory) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type directoryServiceGetServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *directoryServiceGetServer) Send(m *Directory) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _DirectoryService_Put_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(DirectoryServiceServer).Put(&directoryServicePutServer{stream})
|
||||
}
|
||||
|
||||
type DirectoryService_PutServer interface {
|
||||
SendAndClose(*PutDirectoryResponse) error
|
||||
Recv() (*Directory, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type directoryServicePutServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *directoryServicePutServer) SendAndClose(m *PutDirectoryResponse) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *directoryServicePutServer) Recv() (*Directory, error) {
|
||||
m := new(Directory)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// DirectoryService_ServiceDesc is the grpc.ServiceDesc for DirectoryService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var DirectoryService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "tvix.castore.v1.DirectoryService",
|
||||
HandlerType: (*DirectoryServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "Get",
|
||||
Handler: _DirectoryService_Get_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "Put",
|
||||
Handler: _DirectoryService_Put_Handler,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "tvix/castore/protos/rpc_directory.proto",
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue