Skip to content

Commit

Permalink
miniogw: propagate IsLatest for ListObjectVersions
Browse files Browse the repository at this point in the history
This change also bumps dependencies.

(the downgrade is a false positive)

Downgrade: storj.io/storj

Change-Id: Ifc5915ae31a76b0455907e396ec6c094bcdc5e4e
  • Loading branch information
amwolff committed Dec 18, 2024
1 parent 410ee61 commit 1d044e7
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 18 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ require (
github.com/zeebo/errs v1.4.0
go.uber.org/zap v1.27.0
golang.org/x/term v0.25.0
storj.io/common v0.0.0-20241205132646-d4a752c453c4
storj.io/common v0.0.0-20241217150018-eb3fb91616f6
storj.io/minio v0.0.0-20241126095350-0039fe402364
storj.io/uplink v1.13.2-0.20241203175336-8f5548a5ffc7
storj.io/uplink v1.13.2-0.20241217102706-7b803eef38ce
)

require (
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1147,8 +1147,8 @@ sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
storj.io/common v0.0.0-20220719163320-cd2ef8e1b9b0/go.mod h1:mCYV6Ud5+cdbuaxdPD5Zht/HYaIn0sffnnws9ErkrMQ=
storj.io/common v0.0.0-20241205132646-d4a752c453c4 h1:4c/GWblLcQtr9Y7LoUOX0ChIG6uOGTaM5CzbAhJLTJo=
storj.io/common v0.0.0-20241205132646-d4a752c453c4/go.mod h1:CpSUpwG0nOkKMfDI/mqdogMccFP+zFvbTq6LbUCtUPQ=
storj.io/common v0.0.0-20241217150018-eb3fb91616f6 h1:aZnVuoJgm67qc0Nn6ambMC28RYuDtmIVDaY0zdZdeL8=
storj.io/common v0.0.0-20241217150018-eb3fb91616f6/go.mod h1:CpSUpwG0nOkKMfDI/mqdogMccFP+zFvbTq6LbUCtUPQ=
storj.io/drpc v0.0.32/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg=
storj.io/drpc v0.0.35-0.20240709171858-0075ac871661 h1:hLvEV2RMTscX3JHPd+LSQCeTt8i1Q0Yt7U2EdfyMnaQ=
storj.io/drpc v0.0.35-0.20240709171858-0075ac871661/go.mod h1:Y9LZaa8esL1PW2IDMqJE7CFSNq7d5bQ3RI7mGPtmKMg=
Expand All @@ -1162,5 +1162,5 @@ storj.io/monkit-jaeger v0.0.0-20240221095020-52b0792fa6cd h1:XkLxAvogynNQu/1gM/F
storj.io/monkit-jaeger v0.0.0-20240221095020-52b0792fa6cd/go.mod h1:nwyyJiAFAPRu81qBfAE5cBGkVXROYSNJu9pGXLtStHE=
storj.io/picobuf v0.0.3 h1:xAUPB5ZUGfxkqd3bnw3zp01kkWb9wlhg4vtZWUs2S9A=
storj.io/picobuf v0.0.3/go.mod h1:4V4xelV1RSCck5GgmkL/Txw9l6IfX3XcBzegmL5Kudo=
storj.io/uplink v1.13.2-0.20241203175336-8f5548a5ffc7 h1:PHJDJeoekmBTs0QxTFJ6ngs+7cSKEhLlJFHiE1RSW/8=
storj.io/uplink v1.13.2-0.20241203175336-8f5548a5ffc7/go.mod h1:V45DEq768HNYrpG1vcL58EBftAmaJ0UYYobRjz5jAu0=
storj.io/uplink v1.13.2-0.20241217102706-7b803eef38ce h1:dUdELyPL8nE11ElkvF6W1xRbKzeU51ADlyhNml3ogNk=
storj.io/uplink v1.13.2-0.20241217102706-7b803eef38ce/go.mod h1:ifHzh4PAafMSy/adPC1Xc29F6V3U3W6FpCte9nHtngw=
3 changes: 3 additions & 0 deletions miniogw/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -1915,8 +1915,11 @@ func minioVersionedObjectInfo(bucket, etag string, object *versioned.VersionedOb
}

minioObject := minioObjectInfo(bucket, etag, &object.Object)

minioObject.VersionID = encodeVersionID(object.Version)
minioObject.DeleteMarker = object.IsDeleteMarker
minioObject.IsLatest = object.IsLatest

return minioObject
}

Expand Down
8 changes: 4 additions & 4 deletions testsuite/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ require (
github.com/stretchr/testify v1.9.0
github.com/zeebo/errs v1.4.0
go.uber.org/zap v1.27.0
storj.io/common v0.0.0-20241205132646-d4a752c453c4
storj.io/common v0.0.0-20241217150018-eb3fb91616f6
storj.io/gateway v0.0.0-00010101000000-000000000000
storj.io/minio v0.0.0-20241126095350-0039fe402364
storj.io/storj v1.118.8
storj.io/uplink v1.13.2-0.20241203175336-8f5548a5ffc7
storj.io/storj v1.91.0-alpha.0.20241218155244-7d08b87981d4
storj.io/uplink v1.13.2-0.20241217102706-7b803eef38ce
)

require (
Expand Down Expand Up @@ -188,7 +188,7 @@ require (
github.com/shopspring/decimal v1.2.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spacemonkeygo/monkit/v3 v3.0.23 // indirect
github.com/spacemonkeygo/monkit/v3 v3.0.24 // indirect
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
github.com/spacemonkeygo/tlshowdy v0.0.0-20160207005338-8fa2cec1d7cd // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
Expand Down
16 changes: 8 additions & 8 deletions testsuite/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1592,8 +1592,8 @@ github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod
github.com/spacemonkeygo/monkit/v3 v3.0.0-20191108235033-eacca33b3037/go.mod h1:JcK1pCbReQsOsMKF/POFSZCq7drXFybgGmbc27tuwes=
github.com/spacemonkeygo/monkit/v3 v3.0.4/go.mod h1:JcK1pCbReQsOsMKF/POFSZCq7drXFybgGmbc27tuwes=
github.com/spacemonkeygo/monkit/v3 v3.0.18/go.mod h1:kj1ViJhlyADa7DiA4xVnTuPA46lFKbM7mxQTrXCuJP4=
github.com/spacemonkeygo/monkit/v3 v3.0.23 h1:F1qMI6VOY3osKQ0llXsmlYyTpyiq6L7tyjy6fVbxjqM=
github.com/spacemonkeygo/monkit/v3 v3.0.23/go.mod h1:XkZYGzknZwkD0AKUnZaSXhRiVTLCkq7CWVa3IsE72gA=
github.com/spacemonkeygo/monkit/v3 v3.0.24 h1:cKixJ+evHnfJhWNyIZjBy5hoW8LTWmrJXPo18tzLNrk=
github.com/spacemonkeygo/monkit/v3 v3.0.24/go.mod h1:XkZYGzknZwkD0AKUnZaSXhRiVTLCkq7CWVa3IsE72gA=
github.com/spacemonkeygo/monotime v0.0.0-20180824235756-e3f48a95f98a/go.mod h1:ul4bvvnCOPZgq8w0nTkSmWVg/hauVpFS97Am1YM1XXo=
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU=
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc=
Expand Down Expand Up @@ -2668,8 +2668,8 @@ sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
storj.io/common v0.0.0-20220719163320-cd2ef8e1b9b0/go.mod h1:mCYV6Ud5+cdbuaxdPD5Zht/HYaIn0sffnnws9ErkrMQ=
storj.io/common v0.0.0-20241205132646-d4a752c453c4 h1:4c/GWblLcQtr9Y7LoUOX0ChIG6uOGTaM5CzbAhJLTJo=
storj.io/common v0.0.0-20241205132646-d4a752c453c4/go.mod h1:CpSUpwG0nOkKMfDI/mqdogMccFP+zFvbTq6LbUCtUPQ=
storj.io/common v0.0.0-20241217150018-eb3fb91616f6 h1:aZnVuoJgm67qc0Nn6ambMC28RYuDtmIVDaY0zdZdeL8=
storj.io/common v0.0.0-20241217150018-eb3fb91616f6/go.mod h1:CpSUpwG0nOkKMfDI/mqdogMccFP+zFvbTq6LbUCtUPQ=
storj.io/drpc v0.0.32/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg=
storj.io/drpc v0.0.35-0.20240709171858-0075ac871661 h1:hLvEV2RMTscX3JHPd+LSQCeTt8i1Q0Yt7U2EdfyMnaQ=
storj.io/drpc v0.0.35-0.20240709171858-0075ac871661/go.mod h1:Y9LZaa8esL1PW2IDMqJE7CFSNq7d5bQ3RI7mGPtmKMg=
Expand All @@ -2683,7 +2683,7 @@ storj.io/monkit-jaeger v0.0.0-20240221095020-52b0792fa6cd h1:XkLxAvogynNQu/1gM/F
storj.io/monkit-jaeger v0.0.0-20240221095020-52b0792fa6cd/go.mod h1:nwyyJiAFAPRu81qBfAE5cBGkVXROYSNJu9pGXLtStHE=
storj.io/picobuf v0.0.3 h1:xAUPB5ZUGfxkqd3bnw3zp01kkWb9wlhg4vtZWUs2S9A=
storj.io/picobuf v0.0.3/go.mod h1:4V4xelV1RSCck5GgmkL/Txw9l6IfX3XcBzegmL5Kudo=
storj.io/storj v1.118.8 h1:3u5TXgL7xLG5BsTaQS1rE5Fl53ma5N2F9aerfd7bALg=
storj.io/storj v1.118.8/go.mod h1:/5N7TJPppoVFvCNMVsFI9tq/FcNjZyMwxeeY3pY6RUM=
storj.io/uplink v1.13.2-0.20241203175336-8f5548a5ffc7 h1:PHJDJeoekmBTs0QxTFJ6ngs+7cSKEhLlJFHiE1RSW/8=
storj.io/uplink v1.13.2-0.20241203175336-8f5548a5ffc7/go.mod h1:V45DEq768HNYrpG1vcL58EBftAmaJ0UYYobRjz5jAu0=
storj.io/storj v1.91.0-alpha.0.20241218155244-7d08b87981d4 h1:uQFJWluOUOT8QPpBb+1q4XONpqpfA6fn8XCk465LRSM=
storj.io/storj v1.91.0-alpha.0.20241218155244-7d08b87981d4/go.mod h1:6WFvbTRyVZiW6Bg7D7uu8RCsOh10XtiZv3pZDjvZipg=
storj.io/uplink v1.13.2-0.20241217102706-7b803eef38ce h1:dUdELyPL8nE11ElkvF6W1xRbKzeU51ADlyhNml3ogNk=
storj.io/uplink v1.13.2-0.20241217102706-7b803eef38ce/go.mod h1:ifHzh4PAafMSy/adPC1Xc29F6V3U3W6FpCte9nHtngw=
17 changes: 17 additions & 0 deletions testsuite/miniogw/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,16 @@ func TestVersioning(t *testing.T) {
})
require.NoError(t, err)

for listed := range rawClient.API.ListObjects(ctx, bucket, minio.ListObjectsOptions{
WithVersions: true,
}) {
if listed.VersionID == versionIDs[len(versionIDs)-1] {
require.True(t, listed.IsLatest)
} else {
require.False(t, listed.IsLatest)
}
}

removeObjects := func(versionIDs []string) <-chan minio.RemoveObjectResult {
objectsCh := make(chan minio.ObjectInfo)
ctx.Go(func() error {
Expand Down Expand Up @@ -539,18 +549,25 @@ func TestVersioning(t *testing.T) {
err = rawClient.API.RemoveObject(ctx, bucket, "objectA", minio.RemoveObjectOptions{})
require.NoError(t, err)

var latestDeleteMarkerVersionID string
for result := range removeObjects([]string{""}) {
require.NoError(t, result.Err)
require.Equal(t, "objectA", result.ObjectName)
require.NotEmpty(t, result.ObjectVersionID)
require.True(t, result.DeleteMarker)
require.NotEmpty(t, result.DeleteMarkerVersionID)
latestDeleteMarkerVersionID = result.DeleteMarkerVersionID
}

listedIDs := []string{}
for listed := range rawClient.API.ListObjects(ctx, bucket, minio.ListObjectsOptions{
WithVersions: true,
}) {
if listed.VersionID == latestDeleteMarkerVersionID {
require.True(t, listed.IsLatest)
} else {
require.False(t, listed.IsLatest)
}
listedIDs = append(listedIDs, listed.VersionID)
}

Expand Down

0 comments on commit 1d044e7

Please # to comment.