gateway-gcs: use minio.sys.temp/multipart/v1 as url base (#4562)

This commit is contained in:
Krishna Srinivas 2017-06-21 10:27:44 -07:00 committed by Harshavardhana
parent fe426944ea
commit 13ab8e17e2
2 changed files with 8 additions and 6 deletions

View file

@ -43,7 +43,9 @@ const (
// ListObjects we filter out this entry.
gcsMinioPath = "minio.sys.temp"
// Path where multipart objects are saved.
gcsMinioMultipartPath = gcsMinioPath + "/multipart"
// If we change the backend format we will use a different url path like /multipart/v2
// but we will not migrate old data.
gcsMinioMultipartPathV1 = gcsMinioPath + "/multipart/v1"
// Multipart meta file.
gcsMinioMultipartMeta = "gcs.json"
// gcs.json version number
@ -68,12 +70,12 @@ func isGCSPrefix(prefix string) bool {
// Returns name of the multipart meta object.
func gcsMultipartMetaName(uploadID string) string {
return fmt.Sprintf("%s/%s/%s", gcsMinioMultipartPath, uploadID, gcsMinioMultipartMeta)
return fmt.Sprintf("%s/%s/%s", gcsMinioMultipartPathV1, uploadID, gcsMinioMultipartMeta)
}
// Returns name of the part object.
func gcsMultipartDataName(uploadID, etag string) string {
return fmt.Sprintf("%s/%s/%s", gcsMinioMultipartPath, uploadID, etag)
return fmt.Sprintf("%s/%s/%s", gcsMinioMultipartPathV1, uploadID, etag)
}
// Convert Minio errors to minio object layer errors.
@ -726,7 +728,7 @@ func (l *gcsGateway) cleanupMultipartUpload(bucket, key, uploadID string) error
return gcsToObjectError(traceError(err), bucket, key)
}
prefix := fmt.Sprintf("%s/%s/", gcsMinioMultipartPath, uploadID)
prefix := fmt.Sprintf("%s/%s/", gcsMinioMultipartPathV1, uploadID)
// iterate through all parts and delete them
it := l.client.Bucket(bucket).Objects(l.ctx, &storage.Query{Prefix: prefix, Versions: false})

View file

@ -164,7 +164,7 @@ func TestIsGCSMarker(t *testing.T) {
// Test for gcsMultipartMetaName.
func TestGCSMultipartMetaName(t *testing.T) {
uploadID := "a"
expected := pathJoin(gcsMinioMultipartPath, uploadID, gcsMinioMultipartMeta)
expected := pathJoin(gcsMinioMultipartPathV1, uploadID, gcsMinioMultipartMeta)
got := gcsMultipartMetaName(uploadID)
if expected != got {
t.Errorf("expected: %s, got: %s", expected, got)
@ -175,7 +175,7 @@ func TestGCSMultipartMetaName(t *testing.T) {
func TestGCSMultipartDataName(t *testing.T) {
uploadID := "a"
etag := "b"
expected := pathJoin(gcsMinioMultipartPath, uploadID, etag)
expected := pathJoin(gcsMinioMultipartPathV1, uploadID, etag)
got := gcsMultipartDataName(uploadID, etag)
if expected != got {
t.Errorf("expected: %s, got: %s", expected, got)