Misc changes before capturing proper video

- Disable management UI command option
- Remove featureflags option, filesystem and memory already support multipart
- Print informative messages after starting minio server
This commit is contained in:
Harshavardhana
2015-06-03 18:27:13 -07:00
parent a5b9c4fd26
commit a344f5b34d
6 changed files with 61 additions and 47 deletions

View File

@@ -208,7 +208,7 @@ func (h validateAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Ignore resources handler is wrapper handler used for API request resource validation
// Since we do not support all the S3 queries, it is necessary for us to throw back a
// valid error message indicating such a feature to have been not implemented.
// valid error message indicating such a feature is not implemented.
func ignoreResourcesHandler(h http.Handler) http.Handler {
return resourceHandler{h}
}

View File

@@ -17,13 +17,11 @@
package api
import (
"log"
"net/http"
router "github.com/gorilla/mux"
"github.com/minio/minio/pkg/api/logging"
"github.com/minio/minio/pkg/api/quota"
"github.com/minio/minio/pkg/featureflags"
"github.com/minio/minio/pkg/storage/drivers"
)
@@ -44,14 +42,11 @@ func HTTPHandler(driver drivers.Driver) http.Handler {
mux.HandleFunc("/{bucket}", api.putBucketHandler).Methods("PUT")
mux.HandleFunc("/{bucket}", api.headBucketHandler).Methods("HEAD")
mux.HandleFunc("/{bucket}/{object:.*}", api.headObjectHandler).Methods("HEAD")
if featureflags.Get(featureflags.MultipartPutObject) {
log.Println("Enabling feature", featureflags.MultipartPutObject)
mux.HandleFunc("/{bucket}/{object:.*}", api.putObjectPartHandler).Queries("partNumber", "{partNumber:[0-9]+}", "uploadId", "{uploadId:.*}").Methods("PUT")
mux.HandleFunc("/{bucket}/{object:.*}", api.listObjectPartsHandler).Queries("uploadId", "{uploadId:.*}").Methods("GET")
mux.HandleFunc("/{bucket}/{object:.*}", api.completeMultipartUploadHandler).Queries("uploadId", "{uploadId:.*}").Methods("POST")
mux.HandleFunc("/{bucket}/{object:.*}", api.newMultipartUploadHandler).Methods("POST")
mux.HandleFunc("/{bucket}/{object:.*}", api.abortMultipartUploadHandler).Queries("uploadId", "{uploadId:.*}").Methods("DELETE")
}
mux.HandleFunc("/{bucket}/{object:.*}", api.putObjectPartHandler).Queries("partNumber", "{partNumber:[0-9]+}", "uploadId", "{uploadId:.*}").Methods("PUT")
mux.HandleFunc("/{bucket}/{object:.*}", api.listObjectPartsHandler).Queries("uploadId", "{uploadId:.*}").Methods("GET")
mux.HandleFunc("/{bucket}/{object:.*}", api.completeMultipartUploadHandler).Queries("uploadId", "{uploadId:.*}").Methods("POST")
mux.HandleFunc("/{bucket}/{object:.*}", api.newMultipartUploadHandler).Methods("POST")
mux.HandleFunc("/{bucket}/{object:.*}", api.abortMultipartUploadHandler).Queries("uploadId", "{uploadId:.*}").Methods("DELETE")
mux.HandleFunc("/{bucket}/{object:.*}", api.getObjectHandler).Methods("GET")
mux.HandleFunc("/{bucket}/{object:.*}", api.putObjectHandler).Methods("PUT")

View File

@@ -32,7 +32,6 @@ import (
"net/http"
"net/http/httptest"
"github.com/minio/minio/pkg/featureflags"
"github.com/minio/minio/pkg/storage/drivers"
"github.com/minio/minio/pkg/storage/drivers/donut"
"github.com/minio/minio/pkg/storage/drivers/fs"
@@ -1456,7 +1455,6 @@ func (s *MySuite) TestObjectMultipartAbort(c *C) {
}
driver := s.Driver
typedDriver := s.MockDriver
featureflags.Enable(featureflags.MultipartPutObject)
httpHandler := HTTPHandler(driver)
testServer := httptest.NewServer(httpHandler)
@@ -1540,7 +1538,6 @@ func (s *MySuite) TestBucketMultipartList(c *C) {
}
driver := s.Driver
typedDriver := s.MockDriver
featureflags.Enable(featureflags.MultipartPutObject)
httpHandler := HTTPHandler(driver)
testServer := httptest.NewServer(httpHandler)
@@ -1630,7 +1627,6 @@ func (s *MySuite) TestObjectMultipartList(c *C) {
}
driver := s.Driver
typedDriver := s.MockDriver
featureflags.Enable(featureflags.MultipartPutObject)
httpHandler := HTTPHandler(driver)
testServer := httptest.NewServer(httpHandler)
@@ -1715,7 +1711,6 @@ func (s *MySuite) TestObjectMultipart(c *C) {
}
driver := s.Driver
typedDriver := s.MockDriver
featureflags.Enable(featureflags.MultipartPutObject)
httpHandler := HTTPHandler(driver)
testServer := httptest.NewServer(httpHandler)

View File

@@ -17,9 +17,10 @@
package httpserver
import (
"fmt"
"net"
"net/http"
"github.com/minio/minio/pkg/utils/log"
"strings"
)
// Config - http server config
@@ -52,12 +53,35 @@ func start(ctrlChannel <-chan string, errorChannel chan<- error,
Handler: router,
MaxHeaderBytes: 1 << 20,
}
log.Println("Starting HTTP Server on:", config.Address)
host, port, err := net.SplitHostPort(config.Address)
errorChannel <- err
var hosts []string
switch {
case host != "":
hosts = append(hosts, host)
default:
addrs, err := net.InterfaceAddrs()
errorChannel <- err
for _, addr := range addrs {
if addr.Network() == "ip+net" {
h := strings.Split(addr.String(), "/")[0]
if ip := net.ParseIP(h); ip.To4() != nil {
hosts = append(hosts, h)
}
}
}
}
switch {
default:
for _, host := range hosts {
fmt.Printf("Starting minio server on: http://%s:%s\n", host, port)
}
err = httpServer.ListenAndServe()
case config.TLS == true:
fmt.Printf("Starting minio server on: https://%s:%s\n", host, port)
httpServer.TLSConfig = getDefaultTLSConfig()
err = httpServer.ListenAndServeTLS(config.CertFile, config.KeyFile)
}

View File

@@ -32,14 +32,14 @@ import (
"github.com/minio/minio/pkg/utils/log"
)
// MemoryFactory is used to build memory api servers
// MemoryFactory is used to build memory api server
type MemoryFactory struct {
httpserver.Config
MaxMemory uint64
Expiration time.Duration
}
// GetStartServerFunc builds memory api servers
// GetStartServerFunc builds memory api server
func (f MemoryFactory) GetStartServerFunc() StartServerFunc {
return func() (chan<- string, <-chan error) {
_, _, driver := memory.Start(f.MaxMemory, f.Expiration)
@@ -48,13 +48,13 @@ func (f MemoryFactory) GetStartServerFunc() StartServerFunc {
}
}
// FilesystemFactory is used to build filesystem api servers
// FilesystemFactory is used to build filesystem api server
type FilesystemFactory struct {
httpserver.Config
Path string
}
// GetStartServerFunc builds memory api servers
// GetStartServerFunc builds memory api server
func (f FilesystemFactory) GetStartServerFunc() StartServerFunc {
return func() (chan<- string, <-chan error) {
_, _, driver := fs.Start(f.Path)
@@ -63,12 +63,12 @@ func (f FilesystemFactory) GetStartServerFunc() StartServerFunc {
}
}
// WebFactory is used to build web cli servers
// WebFactory is used to build web cli server
type WebFactory struct {
httpserver.Config
}
// GetStartServerFunc builds web cli servers
// GetStartServerFunc builds web cli server
func (f WebFactory) GetStartServerFunc() StartServerFunc {
return func() (chan<- string, <-chan error) {
ctrl, status, _ := httpserver.Start(web.HTTPHandler(), f.Config)
@@ -76,13 +76,13 @@ func (f WebFactory) GetStartServerFunc() StartServerFunc {
}
}
// DonutFactory is used to build donut api servers
// DonutFactory is used to build donut api server
type DonutFactory struct {
httpserver.Config
Paths []string
}
// GetStartServerFunc DonutFactory builds donut api servers
// GetStartServerFunc DonutFactory builds donut api server
func (f DonutFactory) GetStartServerFunc() StartServerFunc {
return func() (chan<- string, <-chan error) {
_, _, driver := donut.Start(f.Paths)
@@ -94,7 +94,7 @@ func (f DonutFactory) GetStartServerFunc() StartServerFunc {
// StartServerFunc describes a function that can be used to start a server with StartMinio
type StartServerFunc func() (chan<- string, <-chan error)
// StartMinio starts minio servers
// StartMinio starts minio server
func StartMinio(servers []StartServerFunc) {
var ctrlChannels []chan<- string
var errChannels []<-chan error