Initialize local nsLocker for gateway instances (#8540)

master
Harshavardhana 5 years ago committed by GitHub
parent 7cdb67680e
commit 3a34d98db8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cmd/gateway-main.go
  2. 16
      cmd/gateway-unsupported.go

@ -220,6 +220,8 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
logger.FatalIf(err, "Unable to initialize gateway backend")
}
newObject = NewGatewayLayerWithLocker(newObject)
// Re-enable logging
logger.Disable = false

@ -26,6 +26,22 @@ import (
"github.com/minio/minio/pkg/policy"
)
// GatewayLocker implements custom NeNSLock implementation
type GatewayLocker struct {
ObjectLayer
nsMutex *nsLockMap
}
// NewNSLock - implements gateway level locker
func (l *GatewayLocker) NewNSLock(ctx context.Context, bucket string, object string) RWLocker {
return l.nsMutex.NewNSLock(ctx, nil, bucket, object)
}
// NewGatewayLayerWithLocker - initialize gateway with locker.
func NewGatewayLayerWithLocker(gwLayer ObjectLayer) ObjectLayer {
return &GatewayLocker{ObjectLayer: gwLayer, nsMutex: newNSLock(false)}
}
// GatewayUnsupported list of unsupported call stubs for gateway.
type GatewayUnsupported struct{}

Loading…
Cancel
Save