mirror of
https://github.com/minio/minio.git
synced 2025-02-05 02:38:07 -05:00
Merge pull request #178 from harshavardhana/pr_out_run_govet_and_fix
This commit is contained in:
commit
1dc14bccfe
4
Makefile
4
Makefile
@ -12,10 +12,12 @@ checkgopath:
|
|||||||
|
|
||||||
getdeps: checkdeps checkgopath
|
getdeps: checkdeps checkgopath
|
||||||
@go get github.com/tools/godep && echo "Installed godep"
|
@go get github.com/tools/godep && echo "Installed godep"
|
||||||
@go get golang.org/x/tools/cmd/cover && echo "Installed cover"
|
@go get golang.org/x/tools/cmd/vet && echo "Install govet"
|
||||||
|
@go get golang.org/x/tools/cmd/cover && echo "Installed gocover"
|
||||||
|
|
||||||
build-all: getdeps
|
build-all: getdeps
|
||||||
@echo "Building Libraries"
|
@echo "Building Libraries"
|
||||||
|
@godep go vet ./...
|
||||||
@godep go generate ./...
|
@godep go generate ./...
|
||||||
@godep go build ./...
|
@godep go build ./...
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ type ObjectListResponse struct {
|
|||||||
Marker string
|
Marker string
|
||||||
MaxKeys int
|
MaxKeys int
|
||||||
IsTruncated bool
|
IsTruncated bool
|
||||||
Contents []*Item `xml:"Contents",innerxml`
|
Contents []*Item `xml:,innerxml`
|
||||||
}
|
}
|
||||||
|
|
||||||
type BucketListResponse struct {
|
type BucketListResponse struct {
|
||||||
@ -38,7 +38,7 @@ type BucketListResponse struct {
|
|||||||
Owner Owner
|
Owner Owner
|
||||||
Buckets struct {
|
Buckets struct {
|
||||||
Bucket []*Bucket
|
Bucket []*Bucket
|
||||||
} `xml:"Buckets",innerxml` // Buckets are nested
|
} `xml:,innerxml` // Buckets are nested
|
||||||
}
|
}
|
||||||
|
|
||||||
type Bucket struct {
|
type Bucket struct {
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// +build amd64
|
|
||||||
|
|
||||||
package erasure
|
package erasure
|
||||||
|
|
||||||
// #cgo CFLAGS: -O0
|
// #cgo CFLAGS: -O0
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// +build amd64
|
|
||||||
|
|
||||||
package erasure
|
package erasure
|
||||||
|
|
||||||
// #cgo CFLAGS: -O0
|
// #cgo CFLAGS: -O0
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
mstorage "github.com/minio-io/minio/pkg/storage"
|
mstorage "github.com/minio-io/minio/pkg/storage"
|
||||||
@ -32,6 +33,7 @@ import (
|
|||||||
type storage struct {
|
type storage struct {
|
||||||
bucketdata map[string]storedBucket
|
bucketdata map[string]storedBucket
|
||||||
objectdata map[string]storedObject
|
objectdata map[string]storedObject
|
||||||
|
lock *sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
type storedBucket struct {
|
type storedBucket struct {
|
||||||
@ -67,6 +69,9 @@ func (storage *storage) GetBucketPolicy(bucket string) (interface{}, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (storage *storage) StoreObject(bucket, key, contentType string, data io.Reader) error {
|
func (storage *storage) StoreObject(bucket, key, contentType string, data io.Reader) error {
|
||||||
|
storage.lock.Lock()
|
||||||
|
defer storage.lock.Unlock()
|
||||||
|
|
||||||
objectKey := bucket + ":" + key
|
objectKey := bucket + ":" + key
|
||||||
|
|
||||||
if _, ok := storage.bucketdata[bucket]; ok == false {
|
if _, ok := storage.bucketdata[bucket]; ok == false {
|
||||||
@ -104,6 +109,8 @@ func (storage *storage) StoreObject(bucket, key, contentType string, data io.Rea
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (storage *storage) StoreBucket(bucketName string) error {
|
func (storage *storage) StoreBucket(bucketName string) error {
|
||||||
|
storage.lock.Lock()
|
||||||
|
defer storage.lock.Unlock()
|
||||||
if !mstorage.IsValidBucket(bucketName) {
|
if !mstorage.IsValidBucket(bucketName) {
|
||||||
return mstorage.BucketNameInvalid{Bucket: bucketName}
|
return mstorage.BucketNameInvalid{Bucket: bucketName}
|
||||||
}
|
}
|
||||||
@ -170,6 +177,7 @@ func Start() (chan<- string, <-chan error, *storage) {
|
|||||||
return ctrlChannel, errorChannel, &storage{
|
return ctrlChannel, errorChannel, &storage{
|
||||||
bucketdata: make(map[string]storedBucket),
|
bucketdata: make(map[string]storedBucket),
|
||||||
objectdata: make(map[string]storedObject),
|
objectdata: make(map[string]storedObject),
|
||||||
|
lock: new(sync.RWMutex),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,22 +14,20 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// +build amd64
|
|
||||||
|
|
||||||
package crc32c
|
package crc32c
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"hash/crc32"
|
"hash/crc32"
|
||||||
)
|
)
|
||||||
|
|
||||||
var castanagoliTable = crc32.MakeTable(crc32.Castagnoli)
|
var castanagoliTable = crc32.MakeTable(crc32.Castagnoli)
|
||||||
|
|
||||||
func Crc32c(buffer []byte) (uint32, error) {
|
func Crc32c(buffer []byte) (uint32, error) {
|
||||||
crc := crc32.New(castanagoliTable)
|
crc := crc32.New(castanagoliTable)
|
||||||
if len(buffer) <= 0 {
|
if len(buffer) <= 0 {
|
||||||
return 0, errors.New("input buffer cannot be null")
|
return 0, errors.New("input buffer cannot be null")
|
||||||
}
|
}
|
||||||
crc.Write(buffer)
|
crc.Write(buffer)
|
||||||
return crc.Sum32(), nil
|
return crc.Sum32(), nil
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// +build amd64
|
|
||||||
|
|
||||||
package crc32c
|
package crc32c
|
||||||
|
|
||||||
// #include <stdint.h>
|
// #include <stdint.h>
|
||||||
|
@ -141,8 +141,6 @@ func (c *Config) ReadConfig() error {
|
|||||||
default:
|
default:
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
c.Users = users
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Loadusers() map[string]User {
|
func Loadusers() map[string]User {
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// +build amd64
|
|
||||||
|
|
||||||
package cpu
|
package cpu
|
||||||
|
|
||||||
// int has_sse41 (void);
|
// int has_sse41 (void);
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// +build amd64
|
|
||||||
|
|
||||||
package cpu
|
package cpu
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// +build amd64
|
|
||||||
|
|
||||||
package sha1
|
package sha1
|
||||||
|
|
||||||
// #include <stdio.h>
|
// #include <stdio.h>
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// +build amd64
|
|
||||||
|
|
||||||
package split
|
package split
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user