mirror of
https://github.com/minio/minio.git
synced 2025-01-23 12:43:16 -05:00
Merge pull request #53 from fkautz/pr_out_moving_gateway_and_storage_driver_to_packages
Moving gateway and storage driver to packages
This commit is contained in:
commit
a6e75f42dd
3
Makefile
3
Makefile
@ -9,7 +9,8 @@ build-signify:
|
||||
cd pkgs/signify && make
|
||||
|
||||
test: build-erasure build-signify
|
||||
godep go test -race -coverprofile=cover.out github.com/minio-io/minio
|
||||
godep go test -race -coverprofile=cover.out github.com/minio-io/minio/pkgs/storage
|
||||
godep go test -race -coverprofile=cover.out github.com/minio-io/minio/pkgs/gateway
|
||||
|
||||
install: build-erasure
|
||||
godep go install github.com/minio-io/minio/cmd/minio-encode
|
||||
|
@ -1,13 +1,15 @@
|
||||
package minio
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/tchap/go-patricia/patricia"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"path"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/minio-io/minio/pkgs/storage"
|
||||
"github.com/tchap/go-patricia/patricia"
|
||||
)
|
||||
|
||||
// Stores system configuration, populated from CLI or test runner
|
||||
@ -195,14 +197,14 @@ func InMemoryStorageDriver(bucket string, input chan ObjectRequest, config Gatew
|
||||
}
|
||||
|
||||
func SimpleFileStorageDriver(bucket string, input chan ObjectRequest, config GatewayConfig) {
|
||||
storage := FileStorage{
|
||||
fileStorage := storage.FileStorage{
|
||||
RootDir: config.dataDir,
|
||||
}
|
||||
for request := range input {
|
||||
switch request.requestType {
|
||||
case "GET":
|
||||
objectPath := path.Join(bucket, request.path)
|
||||
object, err := storage.Get(objectPath)
|
||||
object, err := fileStorage.Get(objectPath)
|
||||
if err != nil {
|
||||
request.callback <- nil
|
||||
} else {
|
||||
@ -210,7 +212,7 @@ func SimpleFileStorageDriver(bucket string, input chan ObjectRequest, config Gat
|
||||
}
|
||||
case "PUT":
|
||||
objectPath := path.Join(bucket, request.path)
|
||||
storage.Put(objectPath, request.object)
|
||||
fileStorage.Put(objectPath, request.object)
|
||||
request.callback <- nil
|
||||
default:
|
||||
request.callback <- errors.New("Unexpected message")
|
@ -1,13 +1,15 @@
|
||||
package minio
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"github.com/gorilla/mux"
|
||||
. "gopkg.in/check.v1"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/minio-io/minio/pkgs/miniotest"
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
type GatewaySuite struct{}
|
||||
@ -102,7 +104,7 @@ func (s *GatewaySuite) TestBucketCreation(c *C) {
|
||||
}
|
||||
|
||||
func (s *GatewaySuite) TestInMemoryBucketOperations(c *C) {
|
||||
simpleFileStorageRootDir, err := makeTempTestDir()
|
||||
simpleFileStorageRootDir, err := miniotest.MakeTempTestDir()
|
||||
c.Assert(err, IsNil)
|
||||
defer os.RemoveAll(simpleFileStorageRootDir)
|
||||
configs := []GatewayConfig{
|
7
pkgs/miniotest/helpers.go
Normal file
7
pkgs/miniotest/helpers.go
Normal file
@ -0,0 +1,7 @@
|
||||
package miniotest
|
||||
|
||||
import "io/ioutil"
|
||||
|
||||
func MakeTempTestDir() (string, error) {
|
||||
return ioutil.TempDir("/tmp", "minio-test-")
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package minio
|
||||
package storage
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
@ -1,4 +1,4 @@
|
||||
package minio
|
||||
package storage
|
||||
|
||||
import (
|
||||
. "gopkg.in/check.v1"
|
@ -1,4 +1,4 @@
|
||||
package minio
|
||||
package storage
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package minio
|
||||
package storage
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
@ -1,8 +0,0 @@
|
||||
package minio
|
||||
|
||||
import (
|
||||
. "gopkg.in/check.v1"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test(t *testing.T) { TestingT(t) }
|
Loading…
x
Reference in New Issue
Block a user