frostfs-s3-gw/legacy/neofs-router.go

38 lines
838 B
Go
Raw Normal View History

2020-07-12 23:00:47 +00:00
package legacy
import (
"github.com/gorilla/mux"
)
func AttachS3API(r *mux.Router, obj ObjectLayer) {
2020-07-12 23:00:47 +00:00
// Add healthcheck router
registerHealthCheckRouter(r)
2020-07-12 23:00:47 +00:00
// Add server metrics router
registerMetricsRouter(r)
2020-07-12 23:00:47 +00:00
// Add API router.
registerAPIRouter(r, true, true)
2020-07-12 23:00:47 +00:00
layer := NewGatewayLayerWithLocker(obj)
// Once endpoints are finalized, initialize the new object api in safe mode.
globalObjLayerMutex.Lock()
globalSafeMode = true
globalObjectAPI = layer
globalObjLayerMutex.Unlock()
// Calls all New() for all sub-systems.
newAllSubsystems()
// Verify if object layer supports
// - encryption
// - compression
verifyObjectLayerFeatures("gateway NeoFS", layer)
// Disable safe mode operation, after all initialization is over.
globalObjLayerMutex.Lock()
globalSafeMode = false
globalObjLayerMutex.Unlock()
}