Merge pull request #53 from fkautz/pr_out_moving_gateway_and_storage_driver_to_packages

Moving gateway and storage driver to packages
master
Harshavardhana 10 years ago
commit a6e75f42dd
  1. 3
      Makefile
  2. 14
      pkgs/gateway/gateway.go
  3. 10
      pkgs/gateway/gateway_test.go
  4. 7
      pkgs/miniotest/helpers.go
  5. 2
      pkgs/storage/file_storage.go
  6. 2
      pkgs/storage/file_storage_test.go
  7. 2
      pkgs/storage/storage.go
  8. 2
      pkgs/storage/storage_test.go
  9. 8
      setup_test.go

@ -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{

@ -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…
Cancel
Save