Skip to content

Commit 63874fc

Browse files
committed
cachedigest: rename array types to list
Signed-off-by: Tonis Tiigi <[email protected]>
1 parent 044e09c commit 63874fc

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

solver/llbsolver/ops/file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (f *fileOp) CacheMap(ctx context.Context, g session.Group, index int) (*sol
158158
}
159159
slices.SortFunc(paths, bytes.Compare)
160160
slices.Reverse(paths) // historical reasons
161-
dgst, err := cachedigest.FromBytes(bytes.Join(paths, []byte{0}), cachedigest.TypeStringArray)
161+
dgst, err := cachedigest.FromBytes(bytes.Join(paths, []byte{0}), cachedigest.TypeStringList)
162162
if err != nil {
163163
return nil, false, err
164164
}

solver/llbsolver/ops/opsutils/contenthash.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ func NewContentHashFunc(selectors []Selector) solver.ResultBasedCacheFunc {
6767
return "", err
6868
}
6969

70-
return cachedigest.FromBytes(bytes.Join(dgsts, []byte{0}), cachedigest.TypeDigestArray)
70+
return cachedigest.FromBytes(bytes.Join(dgsts, []byte{0}), cachedigest.TypeDigestList)
7171
}
7272
}

util/cachedigest/db_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func TestNewHashAndGet(t *testing.T) {
5959
db, cleanup := tempDB(t)
6060
defer cleanup()
6161

62-
h := db.NewHash(TypeStringArray)
62+
h := db.NewHash(TypeStringList)
6363
inputs := [][]byte{
6464
[]byte("foo"),
6565
[]byte("bar"),
@@ -85,7 +85,7 @@ func TestNewHashAndGet(t *testing.T) {
8585

8686
gotType, frames, err := db.Get(context.Background(), sum.String())
8787
require.NoError(t, err)
88-
require.Equal(t, TypeStringArray, gotType)
88+
require.Equal(t, TypeStringList, gotType)
8989

9090
var dataFrames [][]byte
9191
var skipLens []uint32
@@ -154,8 +154,8 @@ func TestAll(t *testing.T) {
154154
typ Type
155155
}{
156156
{[]byte("foo"), TypeString},
157-
{[]byte("bar"), TypeStringArray},
158-
{[]byte("baz"), TypeDigestArray},
157+
{[]byte("bar"), TypeStringList},
158+
{[]byte("baz"), TypeDigestList},
159159
}
160160

161161
var digests []string

util/cachedigest/digest.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import (
1414
type Type string
1515

1616
const (
17-
TypeJSON Type = "json"
18-
TypeString Type = "string"
19-
TypeStringArray Type = "string-array"
20-
TypeDigestArray Type = "digest-array"
21-
TypeFileList Type = "file-list"
22-
TypeFile Type = "file"
17+
TypeJSON Type = "json"
18+
TypeString Type = "string"
19+
TypeStringList Type = "string-list"
20+
TypeDigestList Type = "digest-list"
21+
TypeFileList Type = "file-list"
22+
TypeFile Type = "file"
2323
)
2424

2525
func (t Type) String() string {
@@ -120,7 +120,7 @@ func (r *Record) LoadSubRecords(loader func(d digest.Digest) (Type, []Frame, err
120120
checksums = append(checksums, string(match[0]))
121121
}
122122
}
123-
case TypeDigestArray:
123+
case TypeDigestList:
124124
for _, dgst := range bytes.Split(dt, []byte{0}) {
125125
checksums = append(checksums, string(dgst))
126126
}

0 commit comments

Comments
 (0)