mirror of
https://github.com/minio/minio.git
synced 2025-02-03 01:46:00 -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
|
cd pkgs/signify && make
|
||||||
|
|
||||||
test: build-erasure build-signify
|
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
|
install: build-erasure
|
||||||
godep go install github.com/minio-io/minio/cmd/minio-encode
|
godep go install github.com/minio-io/minio/cmd/minio-encode
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
package minio
|
package gateway
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gorilla/mux"
|
|
||||||
"github.com/tchap/go-patricia/patricia"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"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
|
// 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) {
|
func SimpleFileStorageDriver(bucket string, input chan ObjectRequest, config GatewayConfig) {
|
||||||
storage := FileStorage{
|
fileStorage := storage.FileStorage{
|
||||||
RootDir: config.dataDir,
|
RootDir: config.dataDir,
|
||||||
}
|
}
|
||||||
for request := range input {
|
for request := range input {
|
||||||
switch request.requestType {
|
switch request.requestType {
|
||||||
case "GET":
|
case "GET":
|
||||||
objectPath := path.Join(bucket, request.path)
|
objectPath := path.Join(bucket, request.path)
|
||||||
object, err := storage.Get(objectPath)
|
object, err := fileStorage.Get(objectPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
request.callback <- nil
|
request.callback <- nil
|
||||||
} else {
|
} else {
|
||||||
@ -210,7 +212,7 @@ func SimpleFileStorageDriver(bucket string, input chan ObjectRequest, config Gat
|
|||||||
}
|
}
|
||||||
case "PUT":
|
case "PUT":
|
||||||
objectPath := path.Join(bucket, request.path)
|
objectPath := path.Join(bucket, request.path)
|
||||||
storage.Put(objectPath, request.object)
|
fileStorage.Put(objectPath, request.object)
|
||||||
request.callback <- nil
|
request.callback <- nil
|
||||||
default:
|
default:
|
||||||
request.callback <- errors.New("Unexpected message")
|
request.callback <- errors.New("Unexpected message")
|
@ -1,13 +1,15 @@
|
|||||||
package minio
|
package gateway
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gorilla/mux"
|
|
||||||
. "gopkg.in/check.v1"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/gorilla/mux"
|
||||||
|
"github.com/minio-io/minio/pkgs/miniotest"
|
||||||
|
. "gopkg.in/check.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GatewaySuite struct{}
|
type GatewaySuite struct{}
|
||||||
@ -102,7 +104,7 @@ func (s *GatewaySuite) TestBucketCreation(c *C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *GatewaySuite) TestInMemoryBucketOperations(c *C) {
|
func (s *GatewaySuite) TestInMemoryBucketOperations(c *C) {
|
||||||
simpleFileStorageRootDir, err := makeTempTestDir()
|
simpleFileStorageRootDir, err := miniotest.MakeTempTestDir()
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
defer os.RemoveAll(simpleFileStorageRootDir)
|
defer os.RemoveAll(simpleFileStorageRootDir)
|
||||||
configs := []GatewayConfig{
|
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 (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
@ -1,4 +1,4 @@
|
|||||||
package minio
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "gopkg.in/check.v1"
|
. "gopkg.in/check.v1"
|
@ -1,4 +1,4 @@
|
|||||||
package minio
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@ -1,4 +1,4 @@
|
|||||||
package minio
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"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