about summary refs log tree commit diff
path: root/tvix/castore/protos/rename_node.go
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-10-17T10·53+0100
committerflokli <flokli@flokli.de>2023-10-17T19·51+0000
commite38733a955f6f6fc8962cf0e669d9cf4696bc14d (patch)
tree52dd4e750ab54870d782add53527f29fe5c2e3d2 /tvix/castore/protos/rename_node.go
parent0325ae3ba328ac7b4215057d2c00ac467dd9d820 (diff)
chore(tvix): move castore golang bindings to tvix/castore-go r/6843
Have `tvix/castore/protos` only contain the protos, no go noise.

Make the `.pb.go` file generation a pure Nix build
at `//tvix/castore/protos:go-bindings`, and have a script at
`//tvix:castore-go-generate` (TBD) that copies the results to
`tvix/castore-go`.

`//tvix:castore-go`, with sources in `tvix/castore-go` now contains the
tooling around the generated bindings, and the generated bindings
themselves (So go mod replace workflows still work).

An additional CI step is added from there to ensure idempotenty of
the .pb.go files.

The code.tvl.fyi webserver config is updated to the new source code
path. I'm still unsure if we want to also update the go.mod name. While
being a backwards-incompatible change, it'll probbaly make it easier
where to find these files, and the amount of external consumers is still
low enough.

Part of b/323.

Change-Id: I2edadd118c22ec08e57c693f6cc2ef3261c62489
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9787
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/castore/protos/rename_node.go')
-rw-r--r--tvix/castore/protos/rename_node.go38
1 files changed, 0 insertions, 38 deletions
diff --git a/tvix/castore/protos/rename_node.go b/tvix/castore/protos/rename_node.go
deleted file mode 100644
index 80537b16d38d..000000000000
--- a/tvix/castore/protos/rename_node.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package castorev1
-
-// RenamedNode returns a node with a new name.
-func RenamedNode(node *Node, name string) *Node {
-	if directoryNode := node.GetDirectory(); directoryNode != nil {
-		return &Node{
-			Node: &Node_Directory{
-				Directory: &DirectoryNode{
-					Name:   []byte(name),
-					Digest: directoryNode.GetDigest(),
-					Size:   directoryNode.GetSize(),
-				},
-			},
-		}
-	} else if fileNode := node.GetFile(); fileNode != nil {
-		return &Node{
-			Node: &Node_File{
-				File: &FileNode{
-					Name:       []byte(name),
-					Digest:     fileNode.GetDigest(),
-					Size:       fileNode.GetSize(),
-					Executable: fileNode.GetExecutable(),
-				},
-			},
-		}
-	} else if symlinkNode := node.GetSymlink(); symlinkNode != nil {
-		return &Node{
-			Node: &Node_Symlink{
-				Symlink: &SymlinkNode{
-					Name:   []byte(name),
-					Target: symlinkNode.GetTarget(),
-				},
-			},
-		}
-	} else {
-		panic("unreachable")
-	}
-}