diff --git a/tvix/store-go/pathinfo.pb.go b/tvix/store-go/pathinfo.pb.go index 945e89292..4b393ad4f 100644 --- a/tvix/store-go/pathinfo.pb.go +++ b/tvix/store-go/pathinfo.pb.go @@ -249,11 +249,11 @@ type NARInfo struct { NarSha256 []byte `protobuf:"bytes,2,opt,name=nar_sha256,json=narSha256,proto3" json:"nar_sha256,omitempty"` // The signatures in a .narinfo file. Signatures []*NARInfo_Signature `protobuf:"bytes,3,rep,name=signatures,proto3" json:"signatures,omitempty"` - // A list of references. To validate .narinfo signatures, a fingerprint - // needs to be constructed. - // This fingerprint doesn't just contain the hashes of the output paths of - // all references (like PathInfo.references), but their whole (base)names, - // so we need to keep them somewhere. + // A list of references. To validate .narinfo signatures, a fingerprint needs + // to be constructed. + // This fingerprint doesn't just contain the hashes of the output paths of all + // references (like PathInfo.references), but their whole (base)names, so we + // need to keep them somewhere. ReferenceNames []string `protobuf:"bytes,4,rep,name=reference_names,json=referenceNames,proto3" json:"reference_names,omitempty"` // The StorePath of the .drv file producing this output. // The .drv suffix is omitted in its `name` field. @@ -278,8 +278,8 @@ type NARInfo struct { // There are some restrictions on the possible combinations. // For example, `text` and `fixed:recursive` always imply sha256. // - // We use an enum to encode the possible combinations, and optimize - // for the common case, `fixed:recursive`, identified as `NAR_SHA256`. + // We use an enum to encode the possible combinations, and optimize for the + // common case, `fixed:recursive`, identified as `NAR_SHA256`. Ca *NARInfo_CA `protobuf:"bytes,6,opt,name=ca,proto3" json:"ca,omitempty"` } diff --git a/tvix/store-go/rpc_pathinfo.pb.go b/tvix/store-go/rpc_pathinfo.pb.go index 80e028958..63df3bff2 100644 --- a/tvix/store-go/rpc_pathinfo.pb.go +++ b/tvix/store-go/rpc_pathinfo.pb.go @@ -204,11 +204,11 @@ var file_tvix_store_protos_rpc_pathinfo_proto_rawDesc = []byte{ 0x0a, 0x24, 0x74, 0x76, 0x69, 0x78, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x69, 0x6e, 0x66, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x74, 0x76, 0x69, 0x78, 0x2e, 0x73, 0x74, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x74, 0x76, 0x69, 0x78, 0x2f, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x69, 0x6e, 0x66, - 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x74, 0x76, 0x69, 0x78, 0x2f, 0x63, 0x61, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x63, 0x61, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x47, 0x0a, 0x12, 0x47, 0x65, + 0x72, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x21, 0x74, 0x76, 0x69, 0x78, 0x2f, 0x63, 0x61, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x63, 0x61, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x74, 0x76, 0x69, 0x78, 0x2f, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x70, 0x61, 0x74, 0x68, + 0x69, 0x6e, 0x66, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x47, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x50, 0x61, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x62, 0x79, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0c, 0x62, 0x79, 0x4f, 0x75, diff --git a/tvix/store-go/rpc_pathinfo_grpc.pb.go b/tvix/store-go/rpc_pathinfo_grpc.pb.go index 4096211c1..8d6c0ff84 100644 --- a/tvix/store-go/rpc_pathinfo_grpc.pb.go +++ b/tvix/store-go/rpc_pathinfo_grpc.pb.go @@ -45,22 +45,22 @@ type PathInfoServiceClient interface { // Uploading clients SHOULD obviously not steer other machines to try to // substitute before from the remote end before having finished uploading // PathInfo, Directories and Blobs. - // The returned PathInfo object MAY contain additional narinfo signatures, - // but is otherwise left untouched. + // The returned PathInfo object MAY contain additional narinfo signatures, but + // is otherwise left untouched. Put(ctx context.Context, in *PathInfo, opts ...grpc.CallOption) (*PathInfo, error) // Calculate the NAR representation of the contents specified by the // root_node. The calculation SHOULD be cached server-side for subsequent // requests. // - // All references (to blobs or Directory messages) MUST already exist in - // the store. + // All references (to blobs or Directory messages) MUST already exist in the + // store. // - // The method can be used to produce a Nix fixed-output path, which - // contains the (compressed) sha256 of the NAR content representation in - // the root_node name (suffixed with the name). + // The method can be used to produce a Nix fixed-output path, which contains + // the (compressed) sha256 of the NAR content representation in the root_node + // name (suffixed with the name). // - // It can also be used to calculate arbitrary NAR hashes of output paths, - // in case a legacy Nix Binary Cache frontend is provided. + // 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 *castore_go.Node, opts ...grpc.CallOption) (*CalculateNARResponse, error) // Return a stream of PathInfo messages matching the criteria specified in // ListPathInfoRequest. @@ -150,22 +150,22 @@ type PathInfoServiceServer interface { // Uploading clients SHOULD obviously not steer other machines to try to // substitute before from the remote end before having finished uploading // PathInfo, Directories and Blobs. - // The returned PathInfo object MAY contain additional narinfo signatures, - // but is otherwise left untouched. + // The returned PathInfo object MAY contain additional narinfo signatures, but + // is otherwise left untouched. Put(context.Context, *PathInfo) (*PathInfo, error) // Calculate the NAR representation of the contents specified by the // root_node. The calculation SHOULD be cached server-side for subsequent // requests. // - // All references (to blobs or Directory messages) MUST already exist in - // the store. + // All references (to blobs or Directory messages) MUST already exist in the + // store. // - // The method can be used to produce a Nix fixed-output path, which - // contains the (compressed) sha256 of the NAR content representation in - // the root_node name (suffixed with the name). + // The method can be used to produce a Nix fixed-output path, which contains + // the (compressed) sha256 of the NAR content representation in the root_node + // name (suffixed with the name). // - // It can also be used to calculate arbitrary NAR hashes of output paths, - // in case a legacy Nix Binary Cache frontend is provided. + // 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, *castore_go.Node) (*CalculateNARResponse, error) // Return a stream of PathInfo messages matching the criteria specified in // ListPathInfoRequest. diff --git a/tvix/store/protos/default.nix b/tvix/store/protos/default.nix index 5f56eda79..b5f1e232e 100644 --- a/tvix/store/protos/default.nix +++ b/tvix/store/protos/default.nix @@ -25,6 +25,7 @@ buildPhase = '' export HOME=$TMPDIR buf lint + buf format -d --exit-code buf generate mkdir -p $out diff --git a/tvix/store/protos/pathinfo.proto b/tvix/store/protos/pathinfo.proto index 556219e3d..b03e7e938 100644 --- a/tvix/store/protos/pathinfo.proto +++ b/tvix/store/protos/pathinfo.proto @@ -11,27 +11,27 @@ option go_package = "code.tvl.fyi/tvix/store-go;storev1"; // PathInfo shows information about a Nix Store Path. // That's a single element inside /nix/store. message PathInfo { - // The path can be a directory, file or symlink. - tvix.castore.v1.Node node = 1; + // The path can be a directory, file or symlink. + tvix.castore.v1.Node node = 1; - // List of references (output path hashes) - // This really is the raw *bytes*, after decoding nixbase32, and not a - // base32-encoded string. - repeated bytes references = 2; + // List of references (output path hashes) + // This really is the raw *bytes*, after decoding nixbase32, and not a + // base32-encoded string. + repeated bytes references = 2; - // see below. - NARInfo narinfo = 3; + // see below. + NARInfo narinfo = 3; } // Represents a path in the Nix store (a direct child of STORE_DIR). // It is commonly formatted by a nixbase32-encoding the digest, and // concatenating the name, separated by a `-`. message StorePath { - // The string after digest and `-`. - string name = 1; + // The string after digest and `-`. + string name = 1; - // The digest (20 bytes). - bytes digest = 2; + // The digest (20 bytes). + bytes digest = 2; } // Nix C++ uses NAR (Nix Archive) as a format to transfer store paths, @@ -44,85 +44,85 @@ message StorePath { // moving to another signature scheme is desired. // Even then, it still makes sense to hold this data, for old clients. message NARInfo { - // This represents a (parsed) signature line in a .narinfo file. - message Signature { - string name = 1; - bytes data = 2; - }; + // This represents a (parsed) signature line in a .narinfo file. + message Signature { + string name = 1; + bytes data = 2; + } - // This size of the NAR file, in bytes. - uint64 nar_size = 1; + // This size of the NAR file, in bytes. + uint64 nar_size = 1; - // The sha256 of the NAR file representation. - bytes nar_sha256 = 2; + // The sha256 of the NAR file representation. + bytes nar_sha256 = 2; - // The signatures in a .narinfo file. - repeated Signature signatures = 3; + // The signatures in a .narinfo file. + repeated Signature signatures = 3; - // A list of references. To validate .narinfo signatures, a fingerprint - // needs to be constructed. - // This fingerprint doesn't just contain the hashes of the output paths of - // all references (like PathInfo.references), but their whole (base)names, - // so we need to keep them somewhere. - repeated string reference_names = 4; + // A list of references. To validate .narinfo signatures, a fingerprint needs + // to be constructed. + // This fingerprint doesn't just contain the hashes of the output paths of all + // references (like PathInfo.references), but their whole (base)names, so we + // need to keep them somewhere. + repeated string reference_names = 4; - // The StorePath of the .drv file producing this output. - // The .drv suffix is omitted in its `name` field. - StorePath deriver = 5; + // The StorePath of the .drv file producing this output. + // The .drv suffix is omitted in its `name` field. + StorePath deriver = 5; - // The CA field in the .narinfo. - // Its textual representations seen in the wild are one of the following: - // - `fixed:r:sha256:1gcky5hlf5vqfzpyhihydmm54grhc94mcs8w7xr8613qsqb1v2j6` - // fixed-output derivations using "recursive" `outputHashMode`. - // - `fixed:sha256:19xqkh72crbcba7flwxyi3n293vav6d7qkzkh2v4zfyi4iia8vj8 - // fixed-output derivations using "flat" `outputHashMode` - // - `text:sha256:19xqkh72crbcba7flwxyi3n293vav6d7qkzkh2v4zfyi4iia8vj8` - // Text hashing, used for uploaded .drv files and outputs produced by - // builtins.toFile. - // - // Semantically, they can be split into the following components: - // - "content address prefix". Currently, "fixed" and "text" are supported. - // - "hash mode". Currently, "flat" and "recursive" are supported. - // - "hash type". The underlying hash function used. - // Currently, sha1, md5, sha256, sha512. - // - "digest". The digest itself. - // - // There are some restrictions on the possible combinations. - // For example, `text` and `fixed:recursive` always imply sha256. - // - // We use an enum to encode the possible combinations, and optimize - // for the common case, `fixed:recursive`, identified as `NAR_SHA256`. - CA ca = 6; + // The CA field in the .narinfo. + // Its textual representations seen in the wild are one of the following: + // - `fixed:r:sha256:1gcky5hlf5vqfzpyhihydmm54grhc94mcs8w7xr8613qsqb1v2j6` + // fixed-output derivations using "recursive" `outputHashMode`. + // - `fixed:sha256:19xqkh72crbcba7flwxyi3n293vav6d7qkzkh2v4zfyi4iia8vj8 + // fixed-output derivations using "flat" `outputHashMode` + // - `text:sha256:19xqkh72crbcba7flwxyi3n293vav6d7qkzkh2v4zfyi4iia8vj8` + // Text hashing, used for uploaded .drv files and outputs produced by + // builtins.toFile. + // + // Semantically, they can be split into the following components: + // - "content address prefix". Currently, "fixed" and "text" are supported. + // - "hash mode". Currently, "flat" and "recursive" are supported. + // - "hash type". The underlying hash function used. + // Currently, sha1, md5, sha256, sha512. + // - "digest". The digest itself. + // + // There are some restrictions on the possible combinations. + // For example, `text` and `fixed:recursive` always imply sha256. + // + // We use an enum to encode the possible combinations, and optimize for the + // common case, `fixed:recursive`, identified as `NAR_SHA256`. + CA ca = 6; - message CA { - enum Hash { - // produced when uploading fixed-output store paths using NAR-based - // hashing (`outputHashMode = "recursive"`). - NAR_SHA256 = 0; - NAR_SHA1 = 1; - NAR_SHA512 = 2; - NAR_MD5 = 3; + message CA { + enum Hash { + // produced when uploading fixed-output store paths using NAR-based + // hashing (`outputHashMode = "recursive"`). + NAR_SHA256 = 0; + NAR_SHA1 = 1; + NAR_SHA512 = 2; + NAR_MD5 = 3; - // Produced when uploading .drv files or outputs produced by - // builtins.toFile. - // Produces equivalent digests as FLAT_SHA256, but is a separate - // hashing type in Nix, affecting output path calculation. - TEXT_SHA256 = 4; + // Produced when uploading .drv files or outputs produced by + // builtins.toFile. + // Produces equivalent digests as FLAT_SHA256, but is a separate + // hashing type in Nix, affecting output path calculation. + TEXT_SHA256 = 4; - // Produced when using fixed-output derivations with - // `outputHashMode = "flat"`. - FLAT_SHA1 = 5; - FLAT_MD5 = 6; - FLAT_SHA256 = 7; - FLAT_SHA512 = 8; + // Produced when using fixed-output derivations with + // `outputHashMode = "flat"`. + FLAT_SHA1 = 5; + FLAT_MD5 = 6; + FLAT_SHA256 = 7; + FLAT_SHA512 = 8; - // TODO: what happens in Rust if we introduce a new enum kind here? - } - - // The hashing type used. - Hash type = 1; - - // The digest, in raw bytes. - bytes digest = 2; + // TODO: what happens in Rust if we introduce a new enum kind here? } + + // The hashing type used. + Hash type = 1; + + // The digest, in raw bytes. + bytes digest = 2; + } } diff --git a/tvix/store/protos/rpc_pathinfo.proto b/tvix/store/protos/rpc_pathinfo.proto index 6802d7034..c1c91658a 100644 --- a/tvix/store/protos/rpc_pathinfo.proto +++ b/tvix/store/protos/rpc_pathinfo.proto @@ -4,74 +4,73 @@ syntax = "proto3"; package tvix.store.v1; -import "tvix/store/protos/pathinfo.proto"; import "tvix/castore/protos/castore.proto"; +import "tvix/store/protos/pathinfo.proto"; option go_package = "code.tvl.fyi/tvix/store-go;storev1"; service PathInfoService { - // Return a PathInfo message matching the criteria specified in the - // GetPathInfoRequest message. - rpc Get(GetPathInfoRequest) returns (PathInfo); + // Return a PathInfo message matching the criteria specified in the + // GetPathInfoRequest message. + rpc Get(GetPathInfoRequest) returns (PathInfo); - // Upload a PathInfo object to the remote end. It MUST not return until the - // PathInfo object has been written on the the remote end. - // - // The remote end MAY check if a potential DirectoryNode has already been - // uploaded. - // - // Uploading clients SHOULD obviously not steer other machines to try to - // substitute before from the remote end before having finished uploading - // PathInfo, Directories and Blobs. - // The returned PathInfo object MAY contain additional narinfo signatures, - // but is otherwise left untouched. - rpc Put(PathInfo) returns (PathInfo); + // Upload a PathInfo object to the remote end. It MUST not return until the + // PathInfo object has been written on the the remote end. + // + // The remote end MAY check if a potential DirectoryNode has already been + // uploaded. + // + // Uploading clients SHOULD obviously not steer other machines to try to + // substitute before from the remote end before having finished uploading + // PathInfo, Directories and Blobs. + // The returned PathInfo object MAY contain additional narinfo signatures, but + // is otherwise left untouched. + rpc Put(PathInfo) returns (PathInfo); + // Calculate the NAR representation of the contents specified by the + // root_node. The calculation SHOULD be cached server-side for subsequent + // requests. + // + // All references (to blobs or Directory messages) MUST already exist in the + // store. + // + // The method can be used to produce a Nix fixed-output path, which contains + // the (compressed) sha256 of the NAR content representation in the root_node + // name (suffixed with the name). + // + // It can also be used to calculate arbitrary NAR hashes of output paths, in + // case a legacy Nix Binary Cache frontend is provided. + rpc CalculateNAR(tvix.castore.v1.Node) returns (CalculateNARResponse); - // Calculate the NAR representation of the contents specified by the - // root_node. The calculation SHOULD be cached server-side for subsequent - // requests. - // - // All references (to blobs or Directory messages) MUST already exist in - // the store. - // - // The method can be used to produce a Nix fixed-output path, which - // contains the (compressed) sha256 of the NAR content representation in - // the root_node name (suffixed with the name). - // - // It can also be used to calculate arbitrary NAR hashes of output paths, - // in case a legacy Nix Binary Cache frontend is provided. - rpc CalculateNAR(tvix.castore.v1.Node) returns (CalculateNARResponse); - - // Return a stream of PathInfo messages matching the criteria specified in - // ListPathInfoRequest. - rpc List(ListPathInfoRequest) returns (stream PathInfo); + // Return a stream of PathInfo messages matching the criteria specified in + // ListPathInfoRequest. + rpc List(ListPathInfoRequest) returns (stream PathInfo); } // The parameters that can be used to lookup a (single) PathInfo object. // Currently, only a lookup by output hash is supported. message GetPathInfoRequest { - oneof by_what { - // The output hash of a nix path (20 bytes). - // This is the nixbase32-decoded portion of a Nix output path, so to substitute - // /nix/store/xm35nga2g20mz5sm5l6n8v3bdm86yj83-cowsay-3.04 - // this field would contain nixbase32dec("xm35nga2g20mz5sm5l6n8v3bdm86yj83"). - bytes by_output_hash = 1; - }; + oneof by_what { + // The output hash of a nix path (20 bytes). + // This is the nixbase32-decoded portion of a Nix output path, so to substitute + // /nix/store/xm35nga2g20mz5sm5l6n8v3bdm86yj83-cowsay-3.04 + // this field would contain nixbase32dec("xm35nga2g20mz5sm5l6n8v3bdm86yj83"). + bytes by_output_hash = 1; + } } // The parameters that can be used to lookup (multiple) PathInfo objects. // Currently no filtering is possible, all objects are returned. -message ListPathInfoRequest { } +message ListPathInfoRequest {} // CalculateNARResponse is the response returned by the CalculateNAR request. // // It contains the size of the NAR representation (in bytes), and the sha56 // digest. message CalculateNARResponse { - // This size of the NAR file, in bytes. - uint64 nar_size = 1; + // This size of the NAR file, in bytes. + uint64 nar_size = 1; - // The sha256 of the NAR file representation. - bytes nar_sha256 = 2; + // The sha256 of the NAR file representation. + bytes nar_sha256 = 2; }