Add bucket notification support for NAS gateway (#6908)

Fixes #6885
This commit is contained in:
Harshavardhana
2018-12-03 00:32:14 -08:00
committed by Nitish Tiwari
parent 5549a44566
commit d6af3c1237
4 changed files with 36 additions and 24 deletions

View File

@@ -196,6 +196,15 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
// Add API router.
registerAPIRouter(router)
// Dummy endpoint representing gateway instance.
globalEndpoints = []Endpoint{{
URL: &url.URL{Path: "/minio/gateway"},
IsLocal: true,
}}
// Initialize Admin Peers.
initGlobalAdminPeers(globalEndpoints)
var getCert certs.GetCertificateFunc
if globalTLSCerts != nil {
getCert = globalTLSCerts.GetCertificate
@@ -221,20 +230,24 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
// Create a new config system.
globalConfigSys = NewConfigSys()
if globalEtcdClient != nil {
// Initialize server config.
_ = globalConfigSys.Init(newObject)
} else {
// Initialize server config.
srvCfg := newServerConfig()
// Initialize server config.
srvCfg := newServerConfig()
// Override any values from ENVs.
srvCfg.loadFromEnvs()
// Override any values from ENVs.
srvCfg.loadFromEnvs()
// Load values to cached global values.
srvCfg.loadToCachedConfigs()
// Load values to cached global values.
srvCfg.loadToCachedConfigs()
// hold the mutex lock before a new config is assigned.
globalServerConfigMu.Lock()
globalServerConfig = srvCfg
globalServerConfigMu.Unlock()
// hold the mutex lock before a new config is assigned.
globalServerConfigMu.Lock()
globalServerConfig = srvCfg
globalServerConfigMu.Unlock()
}
// Load logger subsystem
loadLoggers()
@@ -257,7 +270,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
globalIAMSys = NewIAMSys()
if globalEtcdClient != nil {
// Initialize IAM sys.
go globalIAMSys.Init(newObject)
_ = globalIAMSys.Init(newObject)
}
// Create new policy system.
@@ -268,6 +281,9 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
// Create new notification system.
globalNotificationSys = NewNotificationSys(globalServerConfig, globalEndpoints)
if globalEtcdClient != nil {
_ = globalNotificationSys.Init(newObject)
}
// Once endpoints are finalized, initialize the new object api.
globalObjLayerMutex.Lock()