refactor(tvix/nar-bridge): drop reader package

Make the import function usable on any reader.

Change-Id: I84d2004cb73cdd7a11fe8efb0f2efb6335d5e6b0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9527
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
Florian Klink 2023-10-03 12:57:03 +03:00 committed by clbot
parent 6e9a5dcd59
commit b1ff1267be
6 changed files with 41 additions and 56 deletions

View file

@ -9,7 +9,7 @@ import (
"testing"
castorev1pb "code.tvl.fyi/tvix/castore/protos"
"code.tvl.fyi/tvix/nar-bridge/pkg/reader"
"code.tvl.fyi/tvix/nar-bridge/pkg/importer"
"code.tvl.fyi/tvix/nar-bridge/pkg/writer"
storev1pb "code.tvl.fyi/tvix/store/protos"
"github.com/stretchr/testify/require"
@ -159,9 +159,9 @@ func TestFull(t *testing.T) {
filesMap := make(map[string][]byte, 0)
directoriesMap := make(map[string]*castorev1pb.Directory)
r := reader.New(bytes.NewBuffer(narContents))
pathInfo, err := r.Import(
pathInfo, err := importer.Import(
context.Background(),
bytes.NewBuffer(narContents),
func(fileReader io.Reader) error {
fileContents, err := io.ReadAll(fileReader)
require.NoError(t, err)