From 27bfc8cfcdfae849d90bfee67c323f93ffc816dd Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 23 Dec 2022 18:53:57 +0100 Subject: chore(tvix/store/protos): move (Root)Node into separate message This is gonna get used in another place in a second. Co-Authored-By: edef Change-Id: I347c11c8d24379628b7ed09d2c90670c576e686a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7617 Tested-by: BuildkiteCI Reviewed-by: tazjin --- tvix/store/protos/pathinfo.pb.go | 297 ++++++++++++++++++++++++--------------- tvix/store/protos/pathinfo.proto | 18 ++- 2 files changed, 191 insertions(+), 124 deletions(-) (limited to 'tvix/store/protos') diff --git a/tvix/store/protos/pathinfo.pb.go b/tvix/store/protos/pathinfo.pb.go index 0bf50f0a5a12..e06bbf97e45d 100644 --- a/tvix/store/protos/pathinfo.pb.go +++ b/tvix/store/protos/pathinfo.pb.go @@ -75,7 +75,7 @@ func (x NARInfo_HashAlgo) Number() protoreflect.EnumNumber { // Deprecated: Use NARInfo_HashAlgo.Descriptor instead. func (NARInfo_HashAlgo) EnumDescriptor() ([]byte, []int) { - return file_tvix_store_protos_pathinfo_proto_rawDescGZIP(), []int{1, 0} + return file_tvix_store_protos_pathinfo_proto_rawDescGZIP(), []int{2, 0} } // PathInfo shows information about a Nix Store Path. @@ -86,19 +86,13 @@ type PathInfo struct { unknownFields protoimpl.UnknownFields // The path can be a directory, file or symlink. - // - // Types that are assignable to Node: - // - // *PathInfo_Directory - // *PathInfo_File - // *PathInfo_Symlink - Node isPathInfo_Node `protobuf_oneof:"node"` + Node *Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` // List of references (output path hashes) // This really is the raw *bytes*, after decoding nixbase32, and not a // base32-encoded string. - References [][]byte `protobuf:"bytes,4,rep,name=references,proto3" json:"references,omitempty"` + References [][]byte `protobuf:"bytes,2,rep,name=references,proto3" json:"references,omitempty"` // see below. - Narinfo *NARInfo `protobuf:"bytes,5,opt,name=narinfo,proto3" json:"narinfo,omitempty"` + Narinfo *NARInfo `protobuf:"bytes,3,opt,name=narinfo,proto3" json:"narinfo,omitempty"` } func (x *PathInfo) Reset() { @@ -133,69 +127,121 @@ func (*PathInfo) Descriptor() ([]byte, []int) { return file_tvix_store_protos_pathinfo_proto_rawDescGZIP(), []int{0} } -func (m *PathInfo) GetNode() isPathInfo_Node { - if m != nil { - return m.Node +func (x *PathInfo) GetNode() *Node { + if x != nil { + return x.Node } return nil } -func (x *PathInfo) GetDirectory() *DirectoryNode { - if x, ok := x.GetNode().(*PathInfo_Directory); ok { - return x.Directory +func (x *PathInfo) GetReferences() [][]byte { + if x != nil { + return x.References } return nil } -func (x *PathInfo) GetFile() *FileNode { - if x, ok := x.GetNode().(*PathInfo_File); ok { - return x.File +func (x *PathInfo) GetNarinfo() *NARInfo { + if x != nil { + return x.Narinfo } return nil } -func (x *PathInfo) GetSymlink() *SymlinkNode { - if x, ok := x.GetNode().(*PathInfo_Symlink); ok { - return x.Symlink +type Node struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Node: + // + // *Node_Directory + // *Node_File + // *Node_Symlink + Node isNode_Node `protobuf_oneof:"node"` +} + +func (x *Node) Reset() { + *x = Node{} + if protoimpl.UnsafeEnabled { + mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Node) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Node) ProtoMessage() {} + +func (x *Node) ProtoReflect() protoreflect.Message { + mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Node.ProtoReflect.Descriptor instead. +func (*Node) Descriptor() ([]byte, []int) { + return file_tvix_store_protos_pathinfo_proto_rawDescGZIP(), []int{1} +} + +func (m *Node) GetNode() isNode_Node { + if m != nil { + return m.Node } return nil } -func (x *PathInfo) GetReferences() [][]byte { - if x != nil { - return x.References +func (x *Node) GetDirectory() *DirectoryNode { + if x, ok := x.GetNode().(*Node_Directory); ok { + return x.Directory } return nil } -func (x *PathInfo) GetNarinfo() *NARInfo { - if x != nil { - return x.Narinfo +func (x *Node) GetFile() *FileNode { + if x, ok := x.GetNode().(*Node_File); ok { + return x.File } return nil } -type isPathInfo_Node interface { - isPathInfo_Node() +func (x *Node) GetSymlink() *SymlinkNode { + if x, ok := x.GetNode().(*Node_Symlink); ok { + return x.Symlink + } + return nil } -type PathInfo_Directory struct { +type isNode_Node interface { + isNode_Node() +} + +type Node_Directory struct { Directory *DirectoryNode `protobuf:"bytes,1,opt,name=directory,proto3,oneof"` } -type PathInfo_File struct { +type Node_File struct { File *FileNode `protobuf:"bytes,2,opt,name=file,proto3,oneof"` } -type PathInfo_Symlink struct { +type Node_Symlink struct { Symlink *SymlinkNode `protobuf:"bytes,3,opt,name=symlink,proto3,oneof"` } -func (*PathInfo_Directory) isPathInfo_Node() {} +func (*Node_Directory) isNode_Node() {} -func (*PathInfo_File) isPathInfo_Node() {} +func (*Node_File) isNode_Node() {} -func (*PathInfo_Symlink) isPathInfo_Node() {} +func (*Node_Symlink) isNode_Node() {} // Nix C++ uses NAR (Nix Archive) as a format to transfer store paths, // and stores metadata and signatures in NARInfo files. @@ -228,7 +274,7 @@ type NARInfo struct { func (x *NARInfo) Reset() { *x = NARInfo{} if protoimpl.UnsafeEnabled { - mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[1] + mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -241,7 +287,7 @@ func (x *NARInfo) String() string { func (*NARInfo) ProtoMessage() {} func (x *NARInfo) ProtoReflect() protoreflect.Message { - mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[1] + mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -254,7 +300,7 @@ func (x *NARInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use NARInfo.ProtoReflect.Descriptor instead. func (*NARInfo) Descriptor() ([]byte, []int) { - return file_tvix_store_protos_pathinfo_proto_rawDescGZIP(), []int{1} + return file_tvix_store_protos_pathinfo_proto_rawDescGZIP(), []int{2} } func (x *NARInfo) GetNarSize() uint32 { @@ -298,7 +344,7 @@ type NARInfo_NarHash struct { func (x *NARInfo_NarHash) Reset() { *x = NARInfo_NarHash{} if protoimpl.UnsafeEnabled { - mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[2] + mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -311,7 +357,7 @@ func (x *NARInfo_NarHash) String() string { func (*NARInfo_NarHash) ProtoMessage() {} func (x *NARInfo_NarHash) ProtoReflect() protoreflect.Message { - mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[2] + mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -324,7 +370,7 @@ func (x *NARInfo_NarHash) ProtoReflect() protoreflect.Message { // Deprecated: Use NARInfo_NarHash.ProtoReflect.Descriptor instead. func (*NARInfo_NarHash) Descriptor() ([]byte, []int) { - return file_tvix_store_protos_pathinfo_proto_rawDescGZIP(), []int{1, 0} + return file_tvix_store_protos_pathinfo_proto_rawDescGZIP(), []int{2, 0} } func (x *NARInfo_NarHash) GetAlgo() NARInfo_HashAlgo { @@ -354,7 +400,7 @@ type NARInfo_Signature struct { func (x *NARInfo_Signature) Reset() { *x = NARInfo_Signature{} if protoimpl.UnsafeEnabled { - mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[3] + mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -367,7 +413,7 @@ func (x *NARInfo_Signature) String() string { func (*NARInfo_Signature) ProtoMessage() {} func (x *NARInfo_Signature) ProtoReflect() protoreflect.Message { - mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[3] + mi := &file_tvix_store_protos_pathinfo_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -380,7 +426,7 @@ func (x *NARInfo_Signature) ProtoReflect() protoreflect.Message { // Deprecated: Use NARInfo_Signature.ProtoReflect.Descriptor instead. func (*NARInfo_Signature) Descriptor() ([]byte, []int) { - return file_tvix_store_protos_pathinfo_proto_rawDescGZIP(), []int{1, 1} + return file_tvix_store_protos_pathinfo_proto_rawDescGZIP(), []int{2, 1} } func (x *NARInfo_Signature) GetName() string { @@ -405,53 +451,56 @@ var file_tvix_store_protos_pathinfo_proto_rawDesc = []byte{ 0x74, 0x6f, 0x12, 0x0d, 0x74, 0x76, 0x69, 0x78, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x74, 0x76, 0x69, 0x78, 0x2f, 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, 0x89, 0x02, 0x0a, 0x08, 0x50, 0x61, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x3c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x76, 0x69, 0x78, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x6f, 0x64, 0x65, - 0x48, 0x00, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x2d, 0x0a, - 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x76, - 0x69, 0x78, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, - 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x36, 0x0a, 0x07, - 0x73, 0x79, 0x6d, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x74, 0x76, 0x69, 0x78, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, - 0x6d, 0x6c, 0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x07, 0x73, 0x79, 0x6d, - 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x6e, 0x61, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x76, 0x69, 0x78, 0x2e, 0x73, 0x74, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x41, 0x52, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x6e, - 0x61, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x42, 0x06, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x9f, - 0x03, 0x0a, 0x07, 0x4e, 0x41, 0x52, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x61, - 0x72, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6e, 0x61, - 0x72, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x6e, 0x61, 0x72, 0x5f, 0x68, 0x61, 0x73, - 0x68, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x76, 0x69, 0x78, + 0x74, 0x6f, 0x22, 0x85, 0x01, 0x0a, 0x08, 0x50, 0x61, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x27, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, + 0x74, 0x76, 0x69, 0x78, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x6f, + 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x66, 0x65, + 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x72, 0x65, + 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x6e, 0x61, 0x72, 0x69, + 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x76, 0x69, 0x78, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x41, 0x52, 0x49, 0x6e, 0x66, - 0x6f, 0x2e, 0x4e, 0x61, 0x72, 0x48, 0x61, 0x73, 0x68, 0x52, 0x09, 0x6e, 0x61, 0x72, 0x48, 0x61, - 0x73, 0x68, 0x65, 0x73, 0x12, 0x40, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x76, 0x69, 0x78, 0x2e, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x41, 0x52, 0x49, 0x6e, 0x66, 0x6f, - 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x0e, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x1a, - 0x56, 0x0a, 0x07, 0x4e, 0x61, 0x72, 0x48, 0x61, 0x73, 0x68, 0x12, 0x33, 0x0a, 0x04, 0x61, 0x6c, - 0x67, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x74, 0x76, 0x69, 0x78, 0x2e, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x41, 0x52, 0x49, 0x6e, 0x66, 0x6f, - 0x2e, 0x48, 0x61, 0x73, 0x68, 0x41, 0x6c, 0x67, 0x6f, 0x52, 0x04, 0x61, 0x6c, 0x67, 0x6f, 0x12, - 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x42, 0x0a, 0x08, - 0x48, 0x61, 0x73, 0x68, 0x41, 0x6c, 0x67, 0x6f, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, - 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4d, 0x44, 0x35, 0x10, 0x01, 0x12, 0x08, - 0x0a, 0x04, 0x53, 0x48, 0x41, 0x31, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x32, - 0x35, 0x36, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x35, 0x31, 0x32, 0x10, 0x04, - 0x42, 0x28, 0x5a, 0x26, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x74, 0x76, 0x6c, 0x2e, 0x66, 0x79, 0x69, - 0x2f, 0x74, 0x76, 0x69, 0x78, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x73, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x6f, 0x52, 0x07, 0x6e, 0x61, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0xb3, 0x01, 0x0a, 0x04, 0x4e, + 0x6f, 0x64, 0x65, 0x12, 0x3c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x76, 0x69, 0x78, 0x2e, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, + 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x79, 0x12, 0x2d, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x74, 0x76, 0x69, 0x78, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, + 0x12, 0x36, 0x0a, 0x07, 0x73, 0x79, 0x6d, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x74, 0x76, 0x69, 0x78, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x53, 0x79, 0x6d, 0x6c, 0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, + 0x07, 0x73, 0x79, 0x6d, 0x6c, 0x69, 0x6e, 0x6b, 0x42, 0x06, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, + 0x22, 0x9f, 0x03, 0x0a, 0x07, 0x4e, 0x41, 0x52, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, + 0x6e, 0x61, 0x72, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, + 0x6e, 0x61, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x6e, 0x61, 0x72, 0x5f, 0x68, + 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x76, + 0x69, 0x78, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x41, 0x52, 0x49, + 0x6e, 0x66, 0x6f, 0x2e, 0x4e, 0x61, 0x72, 0x48, 0x61, 0x73, 0x68, 0x52, 0x09, 0x6e, 0x61, 0x72, + 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x12, 0x40, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x76, 0x69, + 0x78, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x41, 0x52, 0x49, 0x6e, + 0x66, 0x6f, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0a, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x66, 0x65, + 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0e, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, + 0x73, 0x1a, 0x56, 0x0a, 0x07, 0x4e, 0x61, 0x72, 0x48, 0x61, 0x73, 0x68, 0x12, 0x33, 0x0a, 0x04, + 0x61, 0x6c, 0x67, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x74, 0x76, 0x69, + 0x78, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x41, 0x52, 0x49, 0x6e, + 0x66, 0x6f, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x41, 0x6c, 0x67, 0x6f, 0x52, 0x04, 0x61, 0x6c, 0x67, + 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x0a, 0x09, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x42, + 0x0a, 0x08, 0x48, 0x61, 0x73, 0x68, 0x41, 0x6c, 0x67, 0x6f, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, + 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4d, 0x44, 0x35, 0x10, 0x01, + 0x12, 0x08, 0x0a, 0x04, 0x53, 0x48, 0x41, 0x31, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, + 0x41, 0x32, 0x35, 0x36, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x35, 0x31, 0x32, + 0x10, 0x04, 0x42, 0x28, 0x5a, 0x26, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x74, 0x76, 0x6c, 0x2e, 0x66, + 0x79, 0x69, 0x2f, 0x74, 0x76, 0x69, 0x78, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -467,30 +516,32 @@ func file_tvix_store_protos_pathinfo_proto_rawDescGZIP() []byte { } var file_tvix_store_protos_pathinfo_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_tvix_store_protos_pathinfo_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_tvix_store_protos_pathinfo_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_tvix_store_protos_pathinfo_proto_goTypes = []interface{}{ (NARInfo_HashAlgo)(0), // 0: tvix.store.v1.NARInfo.HashAlgo (*PathInfo)(nil), // 1: tvix.store.v1.PathInfo - (*NARInfo)(nil), // 2: tvix.store.v1.NARInfo - (*NARInfo_NarHash)(nil), // 3: tvix.store.v1.NARInfo.NarHash - (*NARInfo_Signature)(nil), // 4: tvix.store.v1.NARInfo.Signature - (*DirectoryNode)(nil), // 5: tvix.store.v1.DirectoryNode - (*FileNode)(nil), // 6: tvix.store.v1.FileNode - (*SymlinkNode)(nil), // 7: tvix.store.v1.SymlinkNode + (*Node)(nil), // 2: tvix.store.v1.Node + (*NARInfo)(nil), // 3: tvix.store.v1.NARInfo + (*NARInfo_NarHash)(nil), // 4: tvix.store.v1.NARInfo.NarHash + (*NARInfo_Signature)(nil), // 5: tvix.store.v1.NARInfo.Signature + (*DirectoryNode)(nil), // 6: tvix.store.v1.DirectoryNode + (*FileNode)(nil), // 7: tvix.store.v1.FileNode + (*SymlinkNode)(nil), // 8: tvix.store.v1.SymlinkNode } var file_tvix_store_protos_pathinfo_proto_depIdxs = []int32{ - 5, // 0: tvix.store.v1.PathInfo.directory:type_name -> tvix.store.v1.DirectoryNode - 6, // 1: tvix.store.v1.PathInfo.file:type_name -> tvix.store.v1.FileNode - 7, // 2: tvix.store.v1.PathInfo.symlink:type_name -> tvix.store.v1.SymlinkNode - 2, // 3: tvix.store.v1.PathInfo.narinfo:type_name -> tvix.store.v1.NARInfo - 3, // 4: tvix.store.v1.NARInfo.nar_hashes:type_name -> tvix.store.v1.NARInfo.NarHash - 4, // 5: tvix.store.v1.NARInfo.signatures:type_name -> tvix.store.v1.NARInfo.Signature - 0, // 6: tvix.store.v1.NARInfo.NarHash.algo:type_name -> tvix.store.v1.NARInfo.HashAlgo - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 2, // 0: tvix.store.v1.PathInfo.node:type_name -> tvix.store.v1.Node + 3, // 1: tvix.store.v1.PathInfo.narinfo:type_name -> tvix.store.v1.NARInfo + 6, // 2: tvix.store.v1.Node.directory:type_name -> tvix.store.v1.DirectoryNode + 7, // 3: tvix.store.v1.Node.file:type_name -> tvix.store.v1.FileNode + 8, // 4: tvix.store.v1.Node.symlink:type_name -> tvix.store.v1.SymlinkNode + 4, // 5: tvix.store.v1.NARInfo.nar_hashes:type_name -> tvix.store.v1.NARInfo.NarHash + 5, // 6: tvix.store.v1.NARInfo.signatures:type_name -> tvix.store.v1.NARInfo.Signature + 0, // 7: tvix.store.v1.NARInfo.NarHash.algo:type_name -> tvix.store.v1.NARInfo.HashAlgo + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_tvix_store_protos_pathinfo_proto_init() } @@ -513,7 +564,7 @@ func file_tvix_store_protos_pathinfo_proto_init() { } } file_tvix_store_protos_pathinfo_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NARInfo); i { + switch v := v.(*Node); i { case 0: return &v.state case 1: @@ -525,7 +576,7 @@ func file_tvix_store_protos_pathinfo_proto_init() { } } file_tvix_store_protos_pathinfo_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NARInfo_NarHash); i { + switch v := v.(*NARInfo); i { case 0: return &v.state case 1: @@ -537,6 +588,18 @@ func file_tvix_store_protos_pathinfo_proto_init() { } } file_tvix_store_protos_pathinfo_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NARInfo_NarHash); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tvix_store_protos_pathinfo_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NARInfo_Signature); i { case 0: return &v.state @@ -549,10 +612,10 @@ func file_tvix_store_protos_pathinfo_proto_init() { } } } - file_tvix_store_protos_pathinfo_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*PathInfo_Directory)(nil), - (*PathInfo_File)(nil), - (*PathInfo_Symlink)(nil), + file_tvix_store_protos_pathinfo_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*Node_Directory)(nil), + (*Node_File)(nil), + (*Node_Symlink)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -560,7 +623,7 @@ func file_tvix_store_protos_pathinfo_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_tvix_store_protos_pathinfo_proto_rawDesc, NumEnums: 1, - NumMessages: 4, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/tvix/store/protos/pathinfo.proto b/tvix/store/protos/pathinfo.proto index 279bb14848fd..7a9702600605 100644 --- a/tvix/store/protos/pathinfo.proto +++ b/tvix/store/protos/pathinfo.proto @@ -12,19 +12,23 @@ option go_package = "code.tvl.fyi/tvix/store/protos;storev1"; // That's a single element inside /nix/store. message PathInfo { // The path can be a directory, file or symlink. - oneof node { - DirectoryNode directory = 1; - FileNode file = 2; - SymlinkNode symlink = 3; - } + 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 = 4; + repeated bytes references = 2; // see below. - NARInfo narinfo = 5; + NARInfo narinfo = 3; +} + +message Node { + oneof node { + DirectoryNode directory = 1; + FileNode file = 2; + SymlinkNode symlink = 3; + } } // Nix C++ uses NAR (Nix Archive) as a format to transfer store paths, -- cgit 1.4.1