diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-07-26 18:30:26 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-11-08 18:24:14 +0300 |
commit | 77a733b8af393f81c1143ca27324384b1801a090 (patch) | |
tree | c4e17cbfedb872806b3b3c73959806a79d3e3a93 /internal/vfs/local | |
parent | 81e6fdba4fa75b3e882cde818c25a2a76f531de7 (diff) |
refactor: read and use file_sha256 as cache key for zip VFS
Now that the Rails API is serving the archive file_sha256 in the
lookup response, we can move away from using the base URL as the
key to cache the archive.
Changelog: change
Diffstat (limited to 'internal/vfs/local')
-rw-r--r-- | internal/vfs/local/root_test.go | 10 | ||||
-rw-r--r-- | internal/vfs/local/vfs.go | 2 | ||||
-rw-r--r-- | internal/vfs/local/vfs_test.go | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/internal/vfs/local/root_test.go b/internal/vfs/local/root_test.go index a835bae3..e7bbb63f 100644 --- a/internal/vfs/local/root_test.go +++ b/internal/vfs/local/root_test.go @@ -15,7 +15,7 @@ import ( func TestValidatePath(t *testing.T) { ctx := context.Background() - rootVFS, err := localVFS.Root(ctx, ".") + rootVFS, err := localVFS.Root(ctx, ".", "") require.NoError(t, err) root := rootVFS.(*Root) @@ -64,7 +64,7 @@ func TestValidatePath(t *testing.T) { func TestReadlink(t *testing.T) { ctx := context.Background() - root, err := localVFS.Root(ctx, ".") + root, err := localVFS.Root(ctx, ".", "") require.NoError(t, err) tests := map[string]struct { @@ -140,7 +140,7 @@ func TestReadlinkAbsolutePath(t *testing.T) { err = os.Symlink(dirFilePath, symlinkPath) require.NoError(t, err) - root, err := localVFS.Root(context.Background(), dirPath) + root, err := localVFS.Root(context.Background(), dirPath, "") require.NoError(t, err) tests := map[string]struct { @@ -169,7 +169,7 @@ func TestReadlinkAbsolutePath(t *testing.T) { func TestLstat(t *testing.T) { ctx := context.Background() - root, err := localVFS.Root(ctx, ".") + root, err := localVFS.Root(ctx, ".", "") require.NoError(t, err) tests := map[string]struct { @@ -233,7 +233,7 @@ func TestLstat(t *testing.T) { func TestOpen(t *testing.T) { ctx := context.Background() - root, err := localVFS.Root(ctx, ".") + root, err := localVFS.Root(ctx, ".", "") require.NoError(t, err) tests := map[string]struct { diff --git a/internal/vfs/local/vfs.go b/internal/vfs/local/vfs.go index 5cca94fd..cb48ad1c 100644 --- a/internal/vfs/local/vfs.go +++ b/internal/vfs/local/vfs.go @@ -15,7 +15,7 @@ var errNotDirectory = errors.New("path needs to be a directory") type VFS struct{} -func (localFs VFS) Root(ctx context.Context, path string) (vfs.Root, error) { +func (localFs VFS) Root(ctx context.Context, path string, cacheKey string) (vfs.Root, error) { rootPath, err := filepath.Abs(path) if err != nil { return nil, err diff --git a/internal/vfs/local/vfs_test.go b/internal/vfs/local/vfs_test.go index 2072d110..3f84bb39 100644 --- a/internal/vfs/local/vfs_test.go +++ b/internal/vfs/local/vfs_test.go @@ -96,7 +96,7 @@ func TestVFSRoot(t *testing.T) { for name, test := range tests { t.Run(name, func(t *testing.T) { - rootVFS, err := localVFS.Root(context.Background(), filepath.Join(tmpDir, test.path)) + rootVFS, err := localVFS.Root(context.Background(), filepath.Join(tmpDir, test.path), "") if test.expectedIsNotExist { require.Equal(t, test.expectedIsNotExist, vfs.IsNotExist(err)) |