2023-03-18 22:34:19 +01:00
// SPDX-License-Identifier: MIT
// Copyright © 2022 The Tvix Authors
2022-11-19 22:17:24 +01:00
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
2024-12-31 10:05:05 +01:00
// - protoc-gen-go-grpc v1.5.1
2022-11-19 22:17:24 +01:00
// - protoc (unknown)
2023-09-21 21:32:44 +02:00
// source: tvix/castore/protos/rpc_directory.proto
2022-11-19 22:17:24 +01:00
2023-09-21 21:32:44 +02:00
package castorev1
2022-11-19 22:17:24 +01:00
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.
2024-12-31 10:05:05 +01:00
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc . SupportPackageIsVersion9
2022-11-19 22:17:24 +01:00
2023-03-18 22:34:19 +01:00
const (
2023-09-21 21:32:44 +02:00
DirectoryService_Get_FullMethodName = "/tvix.castore.v1.DirectoryService/Get"
DirectoryService_Put_FullMethodName = "/tvix.castore.v1.DirectoryService/Put"
2023-03-18 22:34:19 +01:00
)
2022-11-19 22:17:24 +01:00
// 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.
2024-02-20 09:35:55 +01:00
//
// It is okay for certain implementations to only allow retrieval of
// Directory digests that are at the "root", aka the last element that's
// sent in a Put. This makes sense for implementations bundling closures of
// directories together in batches.
2024-12-31 10:05:05 +01:00
Get ( ctx context . Context , in * GetDirectoryRequest , opts ... grpc . CallOption ) ( grpc . ServerStreamingClient [ Directory ] , error )
2022-11-19 22:17:24 +01:00
// 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.
2024-12-31 10:05:05 +01:00
Put ( ctx context . Context , opts ... grpc . CallOption ) ( grpc . ClientStreamingClient [ Directory , PutDirectoryResponse ] , error )
2022-11-19 22:17:24 +01:00
}
type directoryServiceClient struct {
cc grpc . ClientConnInterface
}
func NewDirectoryServiceClient ( cc grpc . ClientConnInterface ) DirectoryServiceClient {
return & directoryServiceClient { cc }
}
2024-12-31 10:05:05 +01:00
func ( c * directoryServiceClient ) Get ( ctx context . Context , in * GetDirectoryRequest , opts ... grpc . CallOption ) ( grpc . ServerStreamingClient [ Directory ] , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
stream , err := c . cc . NewStream ( ctx , & DirectoryService_ServiceDesc . Streams [ 0 ] , DirectoryService_Get_FullMethodName , cOpts ... )
2022-11-19 22:17:24 +01:00
if err != nil {
return nil , err
}
2024-12-31 10:05:05 +01:00
x := & grpc . GenericClientStream [ GetDirectoryRequest , Directory ] { ClientStream : stream }
2022-11-19 22:17:24 +01:00
if err := x . ClientStream . SendMsg ( in ) ; err != nil {
return nil , err
}
if err := x . ClientStream . CloseSend ( ) ; err != nil {
return nil , err
}
return x , nil
}
2024-12-31 10:05:05 +01:00
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type DirectoryService_GetClient = grpc . ServerStreamingClient [ Directory ]
2022-11-19 22:17:24 +01:00
2024-12-31 10:05:05 +01:00
func ( c * directoryServiceClient ) Put ( ctx context . Context , opts ... grpc . CallOption ) ( grpc . ClientStreamingClient [ Directory , PutDirectoryResponse ] , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
stream , err := c . cc . NewStream ( ctx , & DirectoryService_ServiceDesc . Streams [ 1 ] , DirectoryService_Put_FullMethodName , cOpts ... )
2022-11-19 22:17:24 +01:00
if err != nil {
return nil , err
}
2024-12-31 10:05:05 +01:00
x := & grpc . GenericClientStream [ Directory , PutDirectoryResponse ] { ClientStream : stream }
2022-11-19 22:17:24 +01:00
return x , nil
}
2024-12-31 10:05:05 +01:00
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type DirectoryService_PutClient = grpc . ClientStreamingClient [ Directory , PutDirectoryResponse ]
2022-11-19 22:17:24 +01:00
// DirectoryServiceServer is the server API for DirectoryService service.
// All implementations must embed UnimplementedDirectoryServiceServer
2024-12-31 10:05:05 +01:00
// for forward compatibility.
2022-11-19 22:17:24 +01:00
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.
2024-02-20 09:35:55 +01:00
//
// It is okay for certain implementations to only allow retrieval of
// Directory digests that are at the "root", aka the last element that's
// sent in a Put. This makes sense for implementations bundling closures of
// directories together in batches.
2024-12-31 10:05:05 +01:00
Get ( * GetDirectoryRequest , grpc . ServerStreamingServer [ Directory ] ) error
2022-11-19 22:17:24 +01:00
// 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.
2024-12-31 10:05:05 +01:00
Put ( grpc . ClientStreamingServer [ Directory , PutDirectoryResponse ] ) error
2022-11-19 22:17:24 +01:00
mustEmbedUnimplementedDirectoryServiceServer ( )
}
2024-12-31 10:05:05 +01:00
// UnimplementedDirectoryServiceServer 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 UnimplementedDirectoryServiceServer struct { }
2022-11-19 22:17:24 +01:00
2024-12-31 10:05:05 +01:00
func ( UnimplementedDirectoryServiceServer ) Get ( * GetDirectoryRequest , grpc . ServerStreamingServer [ Directory ] ) error {
2022-11-19 22:17:24 +01:00
return status . Errorf ( codes . Unimplemented , "method Get not implemented" )
}
2024-12-31 10:05:05 +01:00
func ( UnimplementedDirectoryServiceServer ) Put ( grpc . ClientStreamingServer [ Directory , PutDirectoryResponse ] ) error {
2022-11-19 22:17:24 +01:00
return status . Errorf ( codes . Unimplemented , "method Put not implemented" )
}
func ( UnimplementedDirectoryServiceServer ) mustEmbedUnimplementedDirectoryServiceServer ( ) { }
2024-12-31 10:05:05 +01:00
func ( UnimplementedDirectoryServiceServer ) testEmbeddedByValue ( ) { }
2022-11-19 22:17:24 +01:00
// 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 ) {
2024-12-31 10:05:05 +01:00
// If the following call pancis, it indicates UnimplementedDirectoryServiceServer 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 ( )
}
2022-11-19 22:17:24 +01:00
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
}
2024-12-31 10:05:05 +01:00
return srv . ( DirectoryServiceServer ) . Get ( m , & grpc . GenericServerStream [ GetDirectoryRequest , Directory ] { ServerStream : stream } )
2022-11-19 22:17:24 +01:00
}
2024-12-31 10:05:05 +01:00
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type DirectoryService_GetServer = grpc . ServerStreamingServer [ Directory ]
2022-11-19 22:17:24 +01:00
func _DirectoryService_Put_Handler ( srv interface { } , stream grpc . ServerStream ) error {
2024-12-31 10:05:05 +01:00
return srv . ( DirectoryServiceServer ) . Put ( & grpc . GenericServerStream [ Directory , PutDirectoryResponse ] { ServerStream : stream } )
2022-11-19 22:17:24 +01:00
}
2024-12-31 10:05:05 +01:00
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type DirectoryService_PutServer = grpc . ClientStreamingServer [ Directory , PutDirectoryResponse ]
2022-11-19 22:17:24 +01:00
// 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 {
2023-09-21 21:32:44 +02:00
ServiceName : "tvix.castore.v1.DirectoryService" ,
2022-11-19 22:17:24 +01:00
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 ,
} ,
} ,
2023-09-21 21:32:44 +02:00
Metadata : "tvix/castore/protos/rpc_directory.proto" ,
2022-11-19 22:17:24 +01:00
}