diff options
author | Florian Klink <flokli@flokli.de> | 2023-09-03T14·09+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-09-05T20·46+0000 |
commit | da9d706e0a5e4e37087e4841a8fc8edf0da35e77 (patch) | |
tree | d6de951e1458bc0a56aff5a1feb463ee6eeb9592 /tvix/store/protos/rpc_pathinfo_grpc.pb.go | |
parent | e41b5ae3f0cd0814367f1e2f4f256669c849fde7 (diff) |
feat(tvix/store/pathinfosvc): provide listing r/6555
This provides an additional method in the PathInfoService trait, as well as an RPC method on the gRPC layer to list all PathInfo objects in a PathInfoService. Change-Id: I7378f6bbd334bd6ac4e9be92505bd099a1c2b19a Reviewed-on: https://cl.tvl.fyi/c/depot/+/9216 Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store/protos/rpc_pathinfo_grpc.pb.go')
-rw-r--r-- | tvix/store/protos/rpc_pathinfo_grpc.pb.go | 71 |
1 files changed, 70 insertions, 1 deletions
diff --git a/tvix/store/protos/rpc_pathinfo_grpc.pb.go b/tvix/store/protos/rpc_pathinfo_grpc.pb.go index bf83a9b7d98b..d7b6711c0310 100644 --- a/tvix/store/protos/rpc_pathinfo_grpc.pb.go +++ b/tvix/store/protos/rpc_pathinfo_grpc.pb.go @@ -25,6 +25,7 @@ const ( PathInfoService_Get_FullMethodName = "/tvix.store.v1.PathInfoService/Get" PathInfoService_Put_FullMethodName = "/tvix.store.v1.PathInfoService/Put" PathInfoService_CalculateNAR_FullMethodName = "/tvix.store.v1.PathInfoService/CalculateNAR" + PathInfoService_List_FullMethodName = "/tvix.store.v1.PathInfoService/List" ) // PathInfoServiceClient is the client API for PathInfoService service. @@ -60,6 +61,9 @@ type PathInfoServiceClient interface { // It can also be used to calculate arbitrary NAR hashes of output paths, // in case a legacy Nix Binary Cache frontend is provided. CalculateNAR(ctx context.Context, in *Node, opts ...grpc.CallOption) (*CalculateNARResponse, error) + // Return a stream of PathInfo messages matching the criteria specified in + // ListPathInfoRequest. + List(ctx context.Context, in *ListPathInfoRequest, opts ...grpc.CallOption) (PathInfoService_ListClient, error) } type pathInfoServiceClient struct { @@ -97,6 +101,38 @@ func (c *pathInfoServiceClient) CalculateNAR(ctx context.Context, in *Node, opts return out, nil } +func (c *pathInfoServiceClient) List(ctx context.Context, in *ListPathInfoRequest, opts ...grpc.CallOption) (PathInfoService_ListClient, error) { + stream, err := c.cc.NewStream(ctx, &PathInfoService_ServiceDesc.Streams[0], PathInfoService_List_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &pathInfoServiceListClient{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 PathInfoService_ListClient interface { + Recv() (*PathInfo, error) + grpc.ClientStream +} + +type pathInfoServiceListClient struct { + grpc.ClientStream +} + +func (x *pathInfoServiceListClient) Recv() (*PathInfo, error) { + m := new(PathInfo) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // PathInfoServiceServer is the server API for PathInfoService service. // All implementations must embed UnimplementedPathInfoServiceServer // for forward compatibility @@ -130,6 +166,9 @@ type PathInfoServiceServer interface { // It can also be used to calculate arbitrary NAR hashes of output paths, // in case a legacy Nix Binary Cache frontend is provided. CalculateNAR(context.Context, *Node) (*CalculateNARResponse, error) + // Return a stream of PathInfo messages matching the criteria specified in + // ListPathInfoRequest. + List(*ListPathInfoRequest, PathInfoService_ListServer) error mustEmbedUnimplementedPathInfoServiceServer() } @@ -146,6 +185,9 @@ func (UnimplementedPathInfoServiceServer) Put(context.Context, *PathInfo) (*Path func (UnimplementedPathInfoServiceServer) CalculateNAR(context.Context, *Node) (*CalculateNARResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CalculateNAR not implemented") } +func (UnimplementedPathInfoServiceServer) List(*ListPathInfoRequest, PathInfoService_ListServer) error { + return status.Errorf(codes.Unimplemented, "method List not implemented") +} func (UnimplementedPathInfoServiceServer) mustEmbedUnimplementedPathInfoServiceServer() {} // UnsafePathInfoServiceServer may be embedded to opt out of forward compatibility for this service. @@ -213,6 +255,27 @@ func _PathInfoService_CalculateNAR_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _PathInfoService_List_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListPathInfoRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(PathInfoServiceServer).List(m, &pathInfoServiceListServer{stream}) +} + +type PathInfoService_ListServer interface { + Send(*PathInfo) error + grpc.ServerStream +} + +type pathInfoServiceListServer struct { + grpc.ServerStream +} + +func (x *pathInfoServiceListServer) Send(m *PathInfo) error { + return x.ServerStream.SendMsg(m) +} + // PathInfoService_ServiceDesc is the grpc.ServiceDesc for PathInfoService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -233,6 +296,12 @@ var PathInfoService_ServiceDesc = grpc.ServiceDesc{ Handler: _PathInfoService_CalculateNAR_Handler, }, }, - Streams: []grpc.StreamDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "List", + Handler: _PathInfoService_List_Handler, + ServerStreams: true, + }, + }, Metadata: "tvix/store/protos/rpc_pathinfo.proto", } |