diff --git a/main.go b/main.go index 0af36198b..1a4787d0f 100644 --- a/main.go +++ b/main.go @@ -28,8 +28,8 @@ func getStorageType(input string) server.StorageType { switch { case input == "file": return server.File - case input == "inmemory": - return server.InMemory + case input == "memory": + return server.Memory default: { log.Println("Unknown storage type:", input) diff --git a/pkg/api/minioapi/api_test.go b/pkg/api/minioapi/api_test.go index dd6cd0d1b..0cb200db7 100644 --- a/pkg/api/minioapi/api_test.go +++ b/pkg/api/minioapi/api_test.go @@ -30,7 +30,7 @@ import ( "github.com/minio-io/minio/pkg/api/minioapi" 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" ) @@ -42,7 +42,7 @@ type MySuite struct{} var _ = Suite(&MySuite{}) func (s *MySuite) TestNonExistantObject(c *C) { - _, _, storage := inmemory.Start() + _, _, storage := memory.Start() httpHandler := minioapi.HTTPHandler("", storage) testServer := httptest.NewServer(httpHandler) defer testServer.Close() @@ -54,7 +54,7 @@ func (s *MySuite) TestNonExistantObject(c *C) { } func (s *MySuite) TestEmptyObject(c *C) { - _, _, storage := inmemory.Start() + _, _, storage := memory.Start() httpHandler := minioapi.HTTPHandler("", storage) testServer := httptest.NewServer(httpHandler) defer testServer.Close() @@ -79,7 +79,7 @@ func (s *MySuite) TestEmptyObject(c *C) { } func (s *MySuite) TestObject(c *C) { - _, _, storage := inmemory.Start() + _, _, storage := memory.Start() httpHandler := minioapi.HTTPHandler("", storage) testServer := httptest.NewServer(httpHandler) defer testServer.Close() @@ -102,7 +102,7 @@ func (s *MySuite) TestObject(c *C) { } func (s *MySuite) TestMultipleObjects(c *C) { - _, _, storage := inmemory.Start() + _, _, storage := memory.Start() httpHandler := minioapi.HTTPHandler("", storage) testServer := httptest.NewServer(httpHandler) defer testServer.Close() @@ -182,7 +182,7 @@ func (s *MySuite) TestMultipleObjects(c *C) { } func (s *MySuite) TestNotImplemented(c *C) { - _, _, storage := inmemory.Start() + _, _, storage := memory.Start() httpHandler := minioapi.HTTPHandler("", storage) testServer := httptest.NewServer(httpHandler) defer testServer.Close() @@ -193,7 +193,7 @@ func (s *MySuite) TestNotImplemented(c *C) { } func (s *MySuite) TestHeader(c *C) { - _, _, storage := inmemory.Start() + _, _, storage := memory.Start() httpHandler := minioapi.HTTPHandler("", storage) testServer := httptest.NewServer(httpHandler) defer testServer.Close() @@ -216,7 +216,7 @@ func (s *MySuite) TestHeader(c *C) { } func (s *MySuite) TestPutBucket(c *C) { - _, _, storage := inmemory.Start() + _, _, storage := memory.Start() httpHandler := minioapi.HTTPHandler("", storage) testServer := httptest.NewServer(httpHandler) defer testServer.Close() @@ -241,7 +241,7 @@ func (s *MySuite) TestPutBucket(c *C) { } func (s *MySuite) TestPutObject(c *C) { - _, _, storage := inmemory.Start() + _, _, storage := memory.Start() httpHandler := minioapi.HTTPHandler("", storage) testServer := httptest.NewServer(httpHandler) defer testServer.Close() @@ -298,7 +298,7 @@ func (s *MySuite) TestPutObject(c *C) { } func (s *MySuite) TestListBuckets(c *C) { - _, _, storage := inmemory.Start() + _, _, storage := memory.Start() httpHandler := minioapi.HTTPHandler("", storage) testServer := httptest.NewServer(httpHandler) 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) { - _, _, storage := inmemory.Start() + _, _, storage := memory.Start() httpHandler := minioapi.HTTPHandler("", storage) testServer := httptest.NewServer(httpHandler) defer testServer.Close() @@ -403,7 +403,7 @@ func (s *MySuite) TestXMLNameNotInBucketListJson(c *C) { } func (s *MySuite) TestXMLNameNotInObjectListJson(c *C) { - _, _, storage := inmemory.Start() + _, _, storage := memory.Start() httpHandler := minioapi.HTTPHandler("", storage) testServer := httptest.NewServer(httpHandler) defer testServer.Close() @@ -428,7 +428,7 @@ func (s *MySuite) TestXMLNameNotInObjectListJson(c *C) { } func (s *MySuite) TestContentTypePersists(c *C) { - _, _, storage := inmemory.Start() + _, _, storage := memory.Start() httpHandler := minioapi.HTTPHandler("", storage) testServer := httptest.NewServer(httpHandler) defer testServer.Close() diff --git a/pkg/server/server.go b/pkg/server/server.go index 4fcbdea58..1d93d8685 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -26,8 +26,8 @@ import ( "github.com/minio-io/minio/pkg/api/webuiapi" "github.com/minio-io/minio/pkg/server/httpserver" mstorage "github.com/minio-io/minio/pkg/storage" - "github.com/minio-io/minio/pkg/storage/fs" - "github.com/minio-io/minio/pkg/storage/inmemory" + "github.com/minio-io/minio/pkg/storage/file" + "github.com/minio-io/minio/pkg/storage/memory" ) // Config - http server parameters @@ -40,7 +40,7 @@ type Config struct { APIType interface{} } -// MinioAPI - storage type donut, fs, inmemory +// MinioAPI - storage type donut, file, memory type MinioAPI struct { StorageType StorageType } @@ -55,7 +55,7 @@ type StorageType int // Storage types const ( - InMemory = iota + Memory = iota File Donut ) @@ -126,9 +126,9 @@ func getStorageChannels(storageType StorageType) (ctrlChans []chan<- string, sta // - ctrlChans has channel to communicate to storage // - statusChans has channel for messages coming from storage switch { - case storageType == InMemory: + case storageType == Memory: { - ctrlChan, statusChan, storage = inmemory.Start() + ctrlChan, statusChan, storage = memory.Start() ctrlChans = append(ctrlChans, ctrlChan) statusChans = append(statusChans, statusChan) } @@ -139,7 +139,7 @@ func getStorageChannels(storageType StorageType) (ctrlChans []chan<- string, sta return nil, nil, nil } root := path.Join(u.HomeDir, "minio-storage") - ctrlChan, statusChan, storage = fs.Start(root) + ctrlChan, statusChan, storage = file.Start(root) ctrlChans = append(ctrlChans, ctrlChan) statusChans = append(statusChans, statusChan) } diff --git a/pkg/storage/fs/fs.go b/pkg/storage/file/file.go similarity index 98% rename from pkg/storage/fs/fs.go rename to pkg/storage/file/file.go index 70f156ca7..a5463a804 100644 --- a/pkg/storage/fs/fs.go +++ b/pkg/storage/file/file.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package fs +package file import ( "os" diff --git a/pkg/storage/fs/fs_bucket.go b/pkg/storage/file/file_bucket.go similarity index 99% rename from pkg/storage/fs/fs_bucket.go rename to pkg/storage/file/file_bucket.go index c8554d7b8..f36724bcb 100644 --- a/pkg/storage/fs/fs_bucket.go +++ b/pkg/storage/file/file_bucket.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package fs +package file import ( "os" diff --git a/pkg/storage/fs/fs_common.go b/pkg/storage/file/file_common.go similarity index 97% rename from pkg/storage/fs/fs_common.go rename to pkg/storage/file/file_common.go index 627ab7d6e..7e4b29ed0 100644 --- a/pkg/storage/fs/fs_common.go +++ b/pkg/storage/file/file_common.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package fs +package file import ( "bufio" @@ -26,7 +26,7 @@ import ( mstorage "github.com/minio-io/minio/pkg/storage" ) -// Storage - fs local variables +// Storage - file local variables type Storage struct { root string lock *sync.Mutex diff --git a/pkg/storage/fs/fs_filter.go b/pkg/storage/file/file_filter.go similarity index 99% rename from pkg/storage/fs/fs_filter.go rename to pkg/storage/file/file_filter.go index 4a56b2bad..fa88fdba2 100644 --- a/pkg/storage/fs/fs_filter.go +++ b/pkg/storage/file/file_filter.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package fs +package file import ( "os" diff --git a/pkg/storage/fs/fs_object.go b/pkg/storage/file/file_object.go similarity index 99% rename from pkg/storage/fs/fs_object.go rename to pkg/storage/file/file_object.go index 6b8c59f9b..719a83c8d 100644 --- a/pkg/storage/fs/fs_object.go +++ b/pkg/storage/file/file_object.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package fs +package file import ( "io" diff --git a/pkg/storage/fs/fs_policy.go b/pkg/storage/file/file_policy.go similarity index 99% rename from pkg/storage/fs/fs_policy.go rename to pkg/storage/file/file_policy.go index bcded559f..fbd29b5e1 100644 --- a/pkg/storage/fs/fs_policy.go +++ b/pkg/storage/file/file_policy.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package fs +package file import ( "os" diff --git a/pkg/storage/fs/fs_test.go b/pkg/storage/file/file_test.go similarity index 94% rename from pkg/storage/fs/fs_test.go rename to pkg/storage/file/file_test.go index 3f7e6508a..91e2c238d 100644 --- a/pkg/storage/fs/fs_test.go +++ b/pkg/storage/file/file_test.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package fs +package file import ( "io/ioutil" @@ -35,7 +35,7 @@ var _ = Suite(&MySuite{}) func (s *MySuite) TestAPISuite(c *C) { var storageList []string create := func() mstorage.Storage { - path, err := ioutil.TempDir(os.TempDir(), "minio-fs-") + path, err := ioutil.TempDir(os.TempDir(), "minio-file-") c.Check(err, IsNil) storageList = append(storageList, path) _, _, store := Start(path) diff --git a/pkg/storage/inmemory/inmemory.go b/pkg/storage/memory/memory.go similarity index 99% rename from pkg/storage/inmemory/inmemory.go rename to pkg/storage/memory/memory.go index 80e60edf1..b995466d6 100644 --- a/pkg/storage/inmemory/inmemory.go +++ b/pkg/storage/memory/memory.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package inmemory +package memory import ( "bufio" @@ -48,7 +48,7 @@ type storedObject struct { data []byte } -// Start inmemory object server +// Start memory object server func Start() (chan<- string, <-chan error, *Storage) { ctrlChannel := make(chan string) errorChannel := make(chan error) diff --git a/pkg/storage/inmemory/inmemory_test.go b/pkg/storage/memory/memory_test.go similarity index 98% rename from pkg/storage/inmemory/inmemory_test.go rename to pkg/storage/memory/memory_test.go index 5385f1a28..976bd770f 100644 --- a/pkg/storage/inmemory/inmemory_test.go +++ b/pkg/storage/memory/memory_test.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package inmemory +package memory import ( "testing"