Change md5Sum to etag (#4399)

This commit is contained in:
Krishna Srinivas 2017-05-22 20:02:58 -07:00 committed by Harshavardhana
parent 0dab038858
commit 2aa76e7407
3 changed files with 12 additions and 14 deletions

View File

@ -164,19 +164,13 @@ type gcsGateway struct {
// newGCSGateway returns gcs gatewaylayer // newGCSGateway returns gcs gatewaylayer
func newGCSGateway(args cli.Args) (GatewayLayer, error) { func newGCSGateway(args cli.Args) (GatewayLayer, error) {
if len(args) != 1 { if !args.Present() {
return nil, fmt.Errorf("ProjectID expected") return nil, fmt.Errorf("ProjectID expected")
} }
profile := "default"
// TODO: don't know where to set profile yet
_ = profile
endpoint := "storage.googleapis.com" endpoint := "storage.googleapis.com"
secure := true secure := true
projectID := args.First() projectID := args.First()
ctx := context.Background() ctx := context.Background()
// Creates a client. // Creates a client.
@ -485,8 +479,8 @@ func (l *gcsGateway) PutObject(bucket string, key string, size int64, data io.Re
teeReader = io.TeeReader(teeReader, sha256Writer) teeReader = io.TeeReader(teeReader, sha256Writer)
} }
md5sum := metadata["md5Sum"] md5sum := metadata["etag"]
delete(metadata, "md5Sum") delete(metadata, "etag")
object := l.client.Bucket(bucket).Object(key) object := l.client.Bucket(bucket).Object(key)

View File

@ -355,18 +355,18 @@ func gatewayMain(ctx *cli.Context, backendType gatewayBackend) {
} }
serverAddr := ctx.String("address") serverAddr := ctx.String("address")
endpointAddr := ctx.Args().Get(0) endpointAddr := ctx.Args().First()
err := validateGatewayArguments(serverAddr, endpointAddr) err := validateGatewayArguments(serverAddr, endpointAddr)
fatalIf(err, "Invalid argument") fatalIf(err, "Invalid argument")
// Create certs path for SSL configuration. // Create certs path for SSL configuration.
fatalIf(createConfigDir(), "Unable to create configuration directory") fatalIf(createConfigDir(), "Unable to create configuration directory")
initNSLock(false) // Enable local namespace lock.
newObject, err := newGatewayLayer(backendType, ctx.Args()[1:]) newObject, err := newGatewayLayer(backendType, ctx.Args()[1:])
fatalIf(err, "Unable to initialize gateway layer") fatalIf(err, "Unable to initialize gateway layer")
initNSLock(false) // Enable local namespace lock.
router := mux.NewRouter().SkipClean(true) router := mux.NewRouter().SkipClean(true)
// credentials Envs are set globally. // credentials Envs are set globally.
@ -432,9 +432,12 @@ func gatewayMain(ctx *cli.Context, backendType gatewayBackend) {
// Prints the formatted startup message once object layer is initialized. // Prints the formatted startup message once object layer is initialized.
if !quietFlag { if !quietFlag {
mode := "" mode := ""
if gatewayBackend(backendType) == azureBackend { switch gatewayBackend(backendType) {
case azureBackend:
mode = globalMinioModeGatewayAzure mode = globalMinioModeGatewayAzure
} else if gatewayBackend(backendType) == s3Backend { case gcsBackend:
mode = globalMinioModeGatewayGCS
case s3Backend:
mode = globalMinioModeGatewayS3 mode = globalMinioModeGatewayS3
} }
checkUpdate(mode) checkUpdate(mode)

View File

@ -40,6 +40,7 @@ const (
globalMinioModeDistXL = "mode-server-distributed-xl" globalMinioModeDistXL = "mode-server-distributed-xl"
globalMinioModeGatewayAzure = "mode-gateway-azure" globalMinioModeGatewayAzure = "mode-gateway-azure"
globalMinioModeGatewayS3 = "mode-gateway-s3" globalMinioModeGatewayS3 = "mode-gateway-s3"
globalMinioModeGatewayGCS = "mode-gateway-gcs"
// Add new global values here. // Add new global values here.
) )