mirror of
https://github.com/minio/minio.git
synced 2025-01-24 05:03:16 -05:00
Merge pull request #306 from harshavardhana/pr_out_some_necessary_cleanup
This commit is contained in:
commit
dc1589bb5f
4
main.go
4
main.go
@ -28,8 +28,8 @@ func getStorageType(input string) server.StorageType {
|
|||||||
switch {
|
switch {
|
||||||
case input == "file":
|
case input == "file":
|
||||||
return server.File
|
return server.File
|
||||||
case input == "inmemory":
|
case input == "memory":
|
||||||
return server.InMemory
|
return server.Memory
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
log.Println("Unknown storage type:", input)
|
log.Println("Unknown storage type:", input)
|
||||||
|
@ -30,7 +30,7 @@ import (
|
|||||||
|
|
||||||
"github.com/minio-io/minio/pkg/api/minioapi"
|
"github.com/minio-io/minio/pkg/api/minioapi"
|
||||||
mstorage "github.com/minio-io/minio/pkg/storage"
|
mstorage "github.com/minio-io/minio/pkg/storage"
|
||||||
"github.com/minio-io/minio/pkg/storage/inmemory"
|
"github.com/minio-io/minio/pkg/storage/memory"
|
||||||
|
|
||||||
. "gopkg.in/check.v1"
|
. "gopkg.in/check.v1"
|
||||||
)
|
)
|
||||||
@ -42,7 +42,7 @@ type MySuite struct{}
|
|||||||
var _ = Suite(&MySuite{})
|
var _ = Suite(&MySuite{})
|
||||||
|
|
||||||
func (s *MySuite) TestNonExistantObject(c *C) {
|
func (s *MySuite) TestNonExistantObject(c *C) {
|
||||||
_, _, storage := inmemory.Start()
|
_, _, storage := memory.Start()
|
||||||
httpHandler := minioapi.HTTPHandler("", storage)
|
httpHandler := minioapi.HTTPHandler("", storage)
|
||||||
testServer := httptest.NewServer(httpHandler)
|
testServer := httptest.NewServer(httpHandler)
|
||||||
defer testServer.Close()
|
defer testServer.Close()
|
||||||
@ -54,7 +54,7 @@ func (s *MySuite) TestNonExistantObject(c *C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *MySuite) TestEmptyObject(c *C) {
|
func (s *MySuite) TestEmptyObject(c *C) {
|
||||||
_, _, storage := inmemory.Start()
|
_, _, storage := memory.Start()
|
||||||
httpHandler := minioapi.HTTPHandler("", storage)
|
httpHandler := minioapi.HTTPHandler("", storage)
|
||||||
testServer := httptest.NewServer(httpHandler)
|
testServer := httptest.NewServer(httpHandler)
|
||||||
defer testServer.Close()
|
defer testServer.Close()
|
||||||
@ -79,7 +79,7 @@ func (s *MySuite) TestEmptyObject(c *C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *MySuite) TestObject(c *C) {
|
func (s *MySuite) TestObject(c *C) {
|
||||||
_, _, storage := inmemory.Start()
|
_, _, storage := memory.Start()
|
||||||
httpHandler := minioapi.HTTPHandler("", storage)
|
httpHandler := minioapi.HTTPHandler("", storage)
|
||||||
testServer := httptest.NewServer(httpHandler)
|
testServer := httptest.NewServer(httpHandler)
|
||||||
defer testServer.Close()
|
defer testServer.Close()
|
||||||
@ -102,7 +102,7 @@ func (s *MySuite) TestObject(c *C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *MySuite) TestMultipleObjects(c *C) {
|
func (s *MySuite) TestMultipleObjects(c *C) {
|
||||||
_, _, storage := inmemory.Start()
|
_, _, storage := memory.Start()
|
||||||
httpHandler := minioapi.HTTPHandler("", storage)
|
httpHandler := minioapi.HTTPHandler("", storage)
|
||||||
testServer := httptest.NewServer(httpHandler)
|
testServer := httptest.NewServer(httpHandler)
|
||||||
defer testServer.Close()
|
defer testServer.Close()
|
||||||
@ -182,7 +182,7 @@ func (s *MySuite) TestMultipleObjects(c *C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *MySuite) TestNotImplemented(c *C) {
|
func (s *MySuite) TestNotImplemented(c *C) {
|
||||||
_, _, storage := inmemory.Start()
|
_, _, storage := memory.Start()
|
||||||
httpHandler := minioapi.HTTPHandler("", storage)
|
httpHandler := minioapi.HTTPHandler("", storage)
|
||||||
testServer := httptest.NewServer(httpHandler)
|
testServer := httptest.NewServer(httpHandler)
|
||||||
defer testServer.Close()
|
defer testServer.Close()
|
||||||
@ -193,7 +193,7 @@ func (s *MySuite) TestNotImplemented(c *C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *MySuite) TestHeader(c *C) {
|
func (s *MySuite) TestHeader(c *C) {
|
||||||
_, _, storage := inmemory.Start()
|
_, _, storage := memory.Start()
|
||||||
httpHandler := minioapi.HTTPHandler("", storage)
|
httpHandler := minioapi.HTTPHandler("", storage)
|
||||||
testServer := httptest.NewServer(httpHandler)
|
testServer := httptest.NewServer(httpHandler)
|
||||||
defer testServer.Close()
|
defer testServer.Close()
|
||||||
@ -216,7 +216,7 @@ func (s *MySuite) TestHeader(c *C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *MySuite) TestPutBucket(c *C) {
|
func (s *MySuite) TestPutBucket(c *C) {
|
||||||
_, _, storage := inmemory.Start()
|
_, _, storage := memory.Start()
|
||||||
httpHandler := minioapi.HTTPHandler("", storage)
|
httpHandler := minioapi.HTTPHandler("", storage)
|
||||||
testServer := httptest.NewServer(httpHandler)
|
testServer := httptest.NewServer(httpHandler)
|
||||||
defer testServer.Close()
|
defer testServer.Close()
|
||||||
@ -241,7 +241,7 @@ func (s *MySuite) TestPutBucket(c *C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *MySuite) TestPutObject(c *C) {
|
func (s *MySuite) TestPutObject(c *C) {
|
||||||
_, _, storage := inmemory.Start()
|
_, _, storage := memory.Start()
|
||||||
httpHandler := minioapi.HTTPHandler("", storage)
|
httpHandler := minioapi.HTTPHandler("", storage)
|
||||||
testServer := httptest.NewServer(httpHandler)
|
testServer := httptest.NewServer(httpHandler)
|
||||||
defer testServer.Close()
|
defer testServer.Close()
|
||||||
@ -298,7 +298,7 @@ func (s *MySuite) TestPutObject(c *C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *MySuite) TestListBuckets(c *C) {
|
func (s *MySuite) TestListBuckets(c *C) {
|
||||||
_, _, storage := inmemory.Start()
|
_, _, storage := memory.Start()
|
||||||
httpHandler := minioapi.HTTPHandler("", storage)
|
httpHandler := minioapi.HTTPHandler("", storage)
|
||||||
testServer := httptest.NewServer(httpHandler)
|
testServer := httptest.NewServer(httpHandler)
|
||||||
defer testServer.Close()
|
defer testServer.Close()
|
||||||
@ -378,7 +378,7 @@ func verifyHeaders(c *C, header http.Header, date time.Time, size int, contentTy
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *MySuite) TestXMLNameNotInBucketListJson(c *C) {
|
func (s *MySuite) TestXMLNameNotInBucketListJson(c *C) {
|
||||||
_, _, storage := inmemory.Start()
|
_, _, storage := memory.Start()
|
||||||
httpHandler := minioapi.HTTPHandler("", storage)
|
httpHandler := minioapi.HTTPHandler("", storage)
|
||||||
testServer := httptest.NewServer(httpHandler)
|
testServer := httptest.NewServer(httpHandler)
|
||||||
defer testServer.Close()
|
defer testServer.Close()
|
||||||
@ -403,7 +403,7 @@ func (s *MySuite) TestXMLNameNotInBucketListJson(c *C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *MySuite) TestXMLNameNotInObjectListJson(c *C) {
|
func (s *MySuite) TestXMLNameNotInObjectListJson(c *C) {
|
||||||
_, _, storage := inmemory.Start()
|
_, _, storage := memory.Start()
|
||||||
httpHandler := minioapi.HTTPHandler("", storage)
|
httpHandler := minioapi.HTTPHandler("", storage)
|
||||||
testServer := httptest.NewServer(httpHandler)
|
testServer := httptest.NewServer(httpHandler)
|
||||||
defer testServer.Close()
|
defer testServer.Close()
|
||||||
@ -428,7 +428,7 @@ func (s *MySuite) TestXMLNameNotInObjectListJson(c *C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *MySuite) TestContentTypePersists(c *C) {
|
func (s *MySuite) TestContentTypePersists(c *C) {
|
||||||
_, _, storage := inmemory.Start()
|
_, _, storage := memory.Start()
|
||||||
httpHandler := minioapi.HTTPHandler("", storage)
|
httpHandler := minioapi.HTTPHandler("", storage)
|
||||||
testServer := httptest.NewServer(httpHandler)
|
testServer := httptest.NewServer(httpHandler)
|
||||||
defer testServer.Close()
|
defer testServer.Close()
|
||||||
|
@ -26,8 +26,8 @@ import (
|
|||||||
"github.com/minio-io/minio/pkg/api/webuiapi"
|
"github.com/minio-io/minio/pkg/api/webuiapi"
|
||||||
"github.com/minio-io/minio/pkg/server/httpserver"
|
"github.com/minio-io/minio/pkg/server/httpserver"
|
||||||
mstorage "github.com/minio-io/minio/pkg/storage"
|
mstorage "github.com/minio-io/minio/pkg/storage"
|
||||||
"github.com/minio-io/minio/pkg/storage/fs"
|
"github.com/minio-io/minio/pkg/storage/file"
|
||||||
"github.com/minio-io/minio/pkg/storage/inmemory"
|
"github.com/minio-io/minio/pkg/storage/memory"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config - http server parameters
|
// Config - http server parameters
|
||||||
@ -40,7 +40,7 @@ type Config struct {
|
|||||||
APIType interface{}
|
APIType interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MinioAPI - storage type donut, fs, inmemory
|
// MinioAPI - storage type donut, file, memory
|
||||||
type MinioAPI struct {
|
type MinioAPI struct {
|
||||||
StorageType StorageType
|
StorageType StorageType
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ type StorageType int
|
|||||||
|
|
||||||
// Storage types
|
// Storage types
|
||||||
const (
|
const (
|
||||||
InMemory = iota
|
Memory = iota
|
||||||
File
|
File
|
||||||
Donut
|
Donut
|
||||||
)
|
)
|
||||||
@ -126,9 +126,9 @@ func getStorageChannels(storageType StorageType) (ctrlChans []chan<- string, sta
|
|||||||
// - ctrlChans has channel to communicate to storage
|
// - ctrlChans has channel to communicate to storage
|
||||||
// - statusChans has channel for messages coming from storage
|
// - statusChans has channel for messages coming from storage
|
||||||
switch {
|
switch {
|
||||||
case storageType == InMemory:
|
case storageType == Memory:
|
||||||
{
|
{
|
||||||
ctrlChan, statusChan, storage = inmemory.Start()
|
ctrlChan, statusChan, storage = memory.Start()
|
||||||
ctrlChans = append(ctrlChans, ctrlChan)
|
ctrlChans = append(ctrlChans, ctrlChan)
|
||||||
statusChans = append(statusChans, statusChan)
|
statusChans = append(statusChans, statusChan)
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ func getStorageChannels(storageType StorageType) (ctrlChans []chan<- string, sta
|
|||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
root := path.Join(u.HomeDir, "minio-storage")
|
root := path.Join(u.HomeDir, "minio-storage")
|
||||||
ctrlChan, statusChan, storage = fs.Start(root)
|
ctrlChan, statusChan, storage = file.Start(root)
|
||||||
ctrlChans = append(ctrlChans, ctrlChan)
|
ctrlChans = append(ctrlChans, ctrlChan)
|
||||||
statusChans = append(statusChans, statusChan)
|
statusChans = append(statusChans, statusChan)
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package fs
|
package file
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package fs
|
package file
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package fs
|
package file
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
@ -26,7 +26,7 @@ import (
|
|||||||
mstorage "github.com/minio-io/minio/pkg/storage"
|
mstorage "github.com/minio-io/minio/pkg/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Storage - fs local variables
|
// Storage - file local variables
|
||||||
type Storage struct {
|
type Storage struct {
|
||||||
root string
|
root string
|
||||||
lock *sync.Mutex
|
lock *sync.Mutex
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package fs
|
package file
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package fs
|
package file
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package fs
|
package file
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package fs
|
package file
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@ -35,7 +35,7 @@ var _ = Suite(&MySuite{})
|
|||||||
func (s *MySuite) TestAPISuite(c *C) {
|
func (s *MySuite) TestAPISuite(c *C) {
|
||||||
var storageList []string
|
var storageList []string
|
||||||
create := func() mstorage.Storage {
|
create := func() mstorage.Storage {
|
||||||
path, err := ioutil.TempDir(os.TempDir(), "minio-fs-")
|
path, err := ioutil.TempDir(os.TempDir(), "minio-file-")
|
||||||
c.Check(err, IsNil)
|
c.Check(err, IsNil)
|
||||||
storageList = append(storageList, path)
|
storageList = append(storageList, path)
|
||||||
_, _, store := Start(path)
|
_, _, store := Start(path)
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package inmemory
|
package memory
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
@ -48,7 +48,7 @@ type storedObject struct {
|
|||||||
data []byte
|
data []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start inmemory object server
|
// Start memory object server
|
||||||
func Start() (chan<- string, <-chan error, *Storage) {
|
func Start() (chan<- string, <-chan error, *Storage) {
|
||||||
ctrlChannel := make(chan string)
|
ctrlChannel := make(chan string)
|
||||||
errorChannel := make(chan error)
|
errorChannel := make(chan error)
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package inmemory
|
package memory
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
Loading…
x
Reference in New Issue
Block a user