proxy multipart to peers via multipart uploadID (#15926)

This commit is contained in:
Poorna
2022-10-25 10:52:29 -07:00
committed by GitHub
parent 1673778633
commit ce8456a1a9
7 changed files with 114 additions and 10 deletions
+15
View File
@@ -20,8 +20,10 @@ package cmd
import (
"bytes"
"context"
"encoding/base64"
"fmt"
"io"
"strings"
"github.com/klauspost/reedsolomon"
xioutil "github.com/minio/minio/internal/ioutil"
@@ -117,3 +119,16 @@ func writeDataBlocks(ctx context.Context, dst io.Writer, enBlocks [][]byte, data
// Success.
return totalWritten, nil
}
// returns deploymentID from uploadID
func getDeplIDFromUpload(uploadID string) (string, error) {
uploadBytes, err := base64.StdEncoding.DecodeString(uploadID)
if err != nil {
return "", fmt.Errorf("error parsing uploadID %s (%w)", uploadID, err)
}
slc := strings.SplitN(string(uploadBytes), ".", 2)
if len(slc) != 2 {
return "", fmt.Errorf("uploadID %s has incorrect format", uploadID)
}
return slc[0], nil
}