Skip to content

Commit

Permalink
Migrate this project to minio micro services code
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshavardhana committed Oct 16, 2015
1 parent 8c4119c commit 762b798
Show file tree
Hide file tree
Showing 349 changed files with 3,693 additions and 70,609 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ $ cd minio
```

### Compiling Minio from source
Minio uses ``Makefile`` to wrap around some of the limitations of ``go`` build system. To compile Minio source, simply change to your workspace folder and type ``make``.
Minio uses ``Makefile`` to wrap around some of redundant checks done through command line.

```sh
$ make
Checking if proper environment variables are set.. Done
Expand Down
10 changes: 0 additions & 10 deletions CONTRIBUTORS.md

This file was deleted.

5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ RUN apt-get update -y && apt-get install -y -q \
curl \
git \
build-essential \
ca-certificates \
yasm
ca-certificates

RUN curl -O -s https://storage.googleapis.com/golang/${GOLANG_TARBALL} && \
tar -xzf ${GOLANG_TARBALL} -C ${GOROOT%*go*} && \
Expand All @@ -34,6 +33,6 @@ RUN apt-get remove -y build-essential curl git && \

USER minio

EXPOSE 9000 9001
EXPOSE 9000

CMD ["sh", "-c", "${GOPATH}/bin/minio server"]
6 changes: 3 additions & 3 deletions INSTALLGO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
### Build Dependencies
This installation document assumes Ubuntu 14.04+ on x86-64 platform.

##### Install Git, GCC, yasm
##### Install Git, GCC
```sh
$ sudo apt-get install git build-essential yasm
$ sudo apt-get install git build-essential
```

##### Install Go 1.5+
Expand Down Expand Up @@ -39,7 +39,7 @@ $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/maste

##### Install Git, Python
```sh
$ brew install git python yasm
$ brew install git python
```

##### Install Go 1.5+
Expand Down
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ checkdeps:

checkgopath:
@echo "Checking if project is at ${GOPATH}"
@for mcpath in $(echo ${GOPATH} | sed 's/:/\n/g'); do if [ ! -d ${mcpath}/src/github.com/minio/minio ]; then echo "Project not found in ${mcpath}, please follow instructions provided at https://github.com/minio/minio/blob/master/CONTRIBUTING.md#setup-your-minio-github-repository" && exit 1; fi done
@for miniofspath in $(echo ${GOPATH} | sed 's/:/\n/g'); do if [ ! -d ${mcpath}/src/github.com/minio/minio ]; then echo "Project not found in ${miniofspath}, please follow instructions provided at https://github.com/minio/minio/blob/master/CONTRIBUTING.md#setup-your-minio-github-repository" && exit 1; fi done

getdeps: checkdeps checkgopath
@go get github.com/golang/lint/golint && echo "Installed golint:"
@go get golang.org/x/tools/cmd/vet && echo "Installed vet:"
@go get github.com/fzipp/gocyclo && echo "Installed gocyclo:"
@go get -u github.com/remyoudompheng/go-misc/deadcode && echo "Installed deadcode:"

verifiers: getdeps vet fmt lint cyclo

Expand All @@ -34,12 +35,11 @@ lint:

cyclo:
@echo "Running $@:"
@GO15VENDOREXPERIMENT=1 gocyclo -over 25 *.go
@GO15VENDOREXPERIMENT=1 gocyclo -over 25 pkg
@GO15VENDOREXPERIMENT=1 gocyclo -over 50 *.go
@GO15VENDOREXPERIMENT=1 gocyclo -over 50 pkg

build: getdeps verifiers
@echo "Installing minio:"
@GO15VENDOREXPERIMENT=1 go generate ./...
@echo "Installing minio:" #@GO15VENDOREXPERIMENT=1 deadcode

test: build
@echo "Running all testing:"
Expand Down Expand Up @@ -69,4 +69,3 @@ clean:
@echo "Cleaning up all the generated files:"
@rm -fv cover.out
@rm -fv minio
@rm -fv pkg/erasure/*.syso
78 changes: 34 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Minio Server [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/minio/minio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## Minio [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/minio/minio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Minio is a minimal cloud storage server written in Golang and licensed under [Apache license v2](./LICENSE). Minio is compatible with Amazon S3 APIs. [![Build Status](https://travis-ci.org/minio/minio.svg?branch=master)](https://travis-ci.org/minio/minio)
Minio is a minimal cloud storage server for Micro Services & Magnetic Disks. Written in Golang and licensed under [Apache license v2](./LICENSE). Compatible with Amazon S3 APIs.

## Minio Client

Expand All @@ -11,64 +11,54 @@ Minio is a minimal cloud storage server written in Golang and licensed under [Ap
- [Java Library](https://github.com/minio/minio-java)
- [Nodejs Library](https://github.com/minio/minio-js)
- [Python Library](https://github.com/minio/minio-py)
- [.Net Library](https://github.com/minio/minio-dotnet)

### Install [![Build Status](https://travis-ci.org/minio/minio.svg?branch=master)](https://travis-ci.org/minio/minio)[![Build status](https://ci.appveyor.com/api/projects/status/k61d0v3ritbwm2su?svg=true)](https://ci.appveyor.com/project/harshavardhana/minio)

#### Linux, OS X, Windows

## Server Roadmap
~~~
Storage Backend:
- Donut: Erasure coded backend.
- Status: Standalone mode complete.
Storage Operations:
- Collective:
- Status: Work in progress.
Storage Management:
- WebCLI:
- Status: Work in progress.
- Authentication:
- Status: Work in progress.
- Admin Console:
- Status: Work in progress.
- User Console:
- Status: Work in progress.
- Logging:
- Status: Work in progress.
$ go get github.com/minio/minio
~~~

### How to use Minio?

### Install
~~~
$ minio server
NAME:
minio server - Start Minio cloud storage server.
<blockquote>
NOTE: If you happen to compile from source code, following options are not available anymore. Minio master branch is going through lots of rapid changes, documentation will be updated subsequently.
</blockquote>
USAGE:
minio server PATH
#### GNU/Linux
EXAMPLES:
1. Start minio server on Linux.
$ minio server /home/shared
Download ``minio`` from https://dl.minio.io:9000/updates/2015/Jun/linux-amd64/minio
2. Start minio server on Windows.
$ minio server C:\MyShare
3. Start minio server bound to a specific IP:PORT, when you have multiple network interfaces.
$ minio --address 192.168.1.101:9000 /home/shared
~~~
$ wget https://dl.minio.io:9000/updates/2015/Jun/linux-amd64/minio
$ chmod +x minio
$ ./minio mode memory limit 12GB expire 2h

~~~
$ minio server ~/Photos
AccessKey: G5GJRH51R2HSUWYPGIX5 SecretKey: uxhBC1Yscut3/u81l5L8Yp636ZUk32N4m/gFASuZ
#### OS X
To configure Minio Client.
Download ``minio`` from https://dl.minio.io:9000/updates/2015/Jun/darwin-amd64/minio
$ wget https://dl.minio.io:9000/updates/2015/Oct/darwin-amd64/mc
$ chmod 755 mc
$ ./mc config host add localhost:9000 G5GJRH51R2HSUWYPGIX5 uxhBC1Yscut3/u81l5L8Yp636ZUk32N4m/gFASuZ
$ ./mc mb localhost/photobucket
$ ./mc cp ~/Photos... localhost/photobucket
~~~
$ wget https://dl.minio.io:9000/updates/2015/Jun/darwin-amd64/minio
$ chmod +x minio
$ ./minio mode memory limit 12GB expire 2h
Starting minio server:
Listening on http://127.0.0.1:9000
Listening on http://172.30.2.17:9000
~~~

### How to use Minio?

[![asciicast](https://asciinema.org/a/21575.png)](https://asciinema.org/a/21575)

### Contribute to Minio Project
Please follow Minio [Contributor's Guide](./CONTRIBUTING.md)

### Jobs
If you think in Lisp or Haskell and hack in go, you would blend right in. Send your github link to [email protected].


2 changes: 1 addition & 1 deletion server-api-definitions.go → api-definitions.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Minio Cloud Storage, (C) 2014 Minio, Inc.
* Minio Cloud Storage, (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
12 changes: 6 additions & 6 deletions server-api-errors.go → api-errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ const (
NotImplemented
RequestTimeTooSkewed
SignatureDoesNotMatch
TooManyBuckets
MethodNotAllowed
InvalidPart
InvalidPartOrder
AuthorizationHeaderMalformed
MalformedPOSTRequest
BucketNotEmpty
)

// Error codes, non exhaustive list - standard HTTP errors
Expand Down Expand Up @@ -200,11 +200,6 @@ var errorCodeResponse = map[int]APIError{
Description: "The request signature we calculated does not match the signature you provided.",
HTTPStatusCode: http.StatusForbidden,
},
TooManyBuckets: {
Code: "TooManyBuckets",
Description: "You have attempted to create more buckets than allowed.",
HTTPStatusCode: http.StatusBadRequest,
},
MethodNotAllowed: {
Code: "MethodNotAllowed",
Description: "The specified method is not allowed against this resource.",
Expand Down Expand Up @@ -235,6 +230,11 @@ var errorCodeResponse = map[int]APIError{
Description: "The body of your POST request is not well-formed multipart/form-data.",
HTTPStatusCode: http.StatusBadRequest,
},
BucketNotEmpty: {
Code: "BucketNotEmpty",
Description: "The bucket you tried to delete is not empty.",
HTTPStatusCode: http.StatusConflict,
},
}

// errorCodeError provides errorCode to Error. It returns empty if the code provided is unknown
Expand Down
8 changes: 4 additions & 4 deletions server-api-headers.go → api-headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"runtime"
"strconv"

"github.com/minio/minio/pkg/donut"
"github.com/minio/minio/pkg/fs"
)

//// helpers
Expand Down Expand Up @@ -63,7 +63,7 @@ func encodeErrorResponse(response interface{}) []byte {
}

// Write object header
func setObjectHeaders(w http.ResponseWriter, metadata donut.ObjectMetadata, contentRange *httpRange) {
func setObjectHeaders(w http.ResponseWriter, metadata fs.ObjectMetadata, contentRange *httpRange) {
// set common headers
if contentRange != nil {
if contentRange.length > 0 {
Expand All @@ -77,8 +77,8 @@ func setObjectHeaders(w http.ResponseWriter, metadata donut.ObjectMetadata, cont
// set object headers
lastModified := metadata.Created.Format(http.TimeFormat)
// object related headers
w.Header().Set("Content-Type", metadata.Metadata["contentType"])
w.Header().Set("ETag", "\""+metadata.MD5Sum+"\"")
w.Header().Set("Content-Type", "application/octet-stream")
w.Header().Set("ETag", "\""+metadata.Md5+"\"")
w.Header().Set("Last-Modified", lastModified)

// set content range
Expand Down
8 changes: 4 additions & 4 deletions server-api-resources.go → api-resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import (
"net/url"
"strconv"

"github.com/minio/minio/pkg/donut"
"github.com/minio/minio/pkg/fs"
)

// parse bucket url queries
func getBucketResources(values url.Values) (v donut.BucketResourcesMetadata) {
func getBucketResources(values url.Values) (v fs.BucketResourcesMetadata) {
v.Prefix = values.Get("prefix")
v.Marker = values.Get("marker")
v.Maxkeys, _ = strconv.Atoi(values.Get("max-keys"))
Expand All @@ -34,7 +34,7 @@ func getBucketResources(values url.Values) (v donut.BucketResourcesMetadata) {
}

// part bucket url queries for ?uploads
func getBucketMultipartResources(values url.Values) (v donut.BucketMultipartResourcesMetadata) {
func getBucketMultipartResources(values url.Values) (v fs.BucketMultipartResourcesMetadata) {
v.Prefix = values.Get("prefix")
v.KeyMarker = values.Get("key-marker")
v.MaxUploads, _ = strconv.Atoi(values.Get("max-uploads"))
Expand All @@ -45,7 +45,7 @@ func getBucketMultipartResources(values url.Values) (v donut.BucketMultipartReso
}

// parse object url queries
func getObjectResources(values url.Values) (v donut.ObjectResourcesMetadata) {
func getObjectResources(values url.Values) (v fs.ObjectResourcesMetadata) {
v.UploadID = values.Get("uploadId")
v.PartNumberMarker, _ = strconv.Atoi(values.Get("part-number-marker"))
v.MaxParts, _ = strconv.Atoi(values.Get("max-parts"))
Expand Down
18 changes: 9 additions & 9 deletions server-api-response.go → api-response.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"net/http"

"github.com/minio/minio/pkg/donut"
"github.com/minio/minio/pkg/fs"
)

// Reply date format
Expand All @@ -33,7 +33,7 @@ const (
//
// output:
// populated struct that can be serialized to match xml and json api spec output
func generateListBucketsResponse(buckets []donut.BucketMetadata) ListBucketsResponse {
func generateListBucketsResponse(buckets []fs.BucketMetadata) ListBucketsResponse {
var listbuckets []*Bucket
var data = ListBucketsResponse{}
var owner = Owner{}
Expand All @@ -55,7 +55,7 @@ func generateListBucketsResponse(buckets []donut.BucketMetadata) ListBucketsResp
}

// generates an AccessControlPolicy response for the said ACL.
func generateAccessControlPolicyResponse(acl donut.BucketACL) AccessControlPolicyResponse {
func generateAccessControlPolicyResponse(acl fs.BucketACL) AccessControlPolicyResponse {
accessCtrlPolicyResponse := AccessControlPolicyResponse{}
accessCtrlPolicyResponse.Owner = Owner{
ID: "minio",
Expand Down Expand Up @@ -92,7 +92,7 @@ func generateAccessControlPolicyResponse(acl donut.BucketACL) AccessControlPolic
}

// generates an ListObjects response for the said bucket with other enumerated options.
func generateListObjectsResponse(bucket string, objects []donut.ObjectMetadata, bucketResources donut.BucketResourcesMetadata) ListObjectsResponse {
func generateListObjectsResponse(bucket string, objects []fs.ObjectMetadata, bucketResources fs.BucketResourcesMetadata) ListObjectsResponse {
var contents []*Object
var prefixes []*CommonPrefix
var owner = Owner{}
Expand All @@ -108,7 +108,7 @@ func generateListObjectsResponse(bucket string, objects []donut.ObjectMetadata,
}
content.Key = object.Object
content.LastModified = object.Created.Format(rfcFormat)
content.ETag = "\"" + object.MD5Sum + "\""
content.ETag = "\"" + object.Md5 + "\""
content.Size = object.Size
content.StorageClass = "STANDARD"
content.Owner = owner
Expand Down Expand Up @@ -152,11 +152,11 @@ func generateCompleteMultpartUploadResponse(bucket, key, location, etag string)
}

// generateListPartsResult
func generateListPartsResponse(objectMetadata donut.ObjectResourcesMetadata) ListPartsResponse {
func generateListPartsResponse(objectMetadata fs.ObjectResourcesMetadata) ListPartsResponse {
// TODO - support EncodingType in xml decoding
listPartsResponse := ListPartsResponse{}
listPartsResponse.Bucket = objectMetadata.Bucket
listPartsResponse.Key = objectMetadata.Key
listPartsResponse.Key = objectMetadata.Object
listPartsResponse.UploadID = objectMetadata.UploadID
listPartsResponse.StorageClass = "STANDARD"
listPartsResponse.Initiator.ID = "minio"
Expand All @@ -182,7 +182,7 @@ func generateListPartsResponse(objectMetadata donut.ObjectResourcesMetadata) Lis
}

// generateListMultipartUploadsResponse
func generateListMultipartUploadsResponse(bucket string, metadata donut.BucketMultipartResourcesMetadata) ListMultipartUploadsResponse {
func generateListMultipartUploadsResponse(bucket string, metadata fs.BucketMultipartResourcesMetadata) ListMultipartUploadsResponse {
listMultipartUploadsResponse := ListMultipartUploadsResponse{}
listMultipartUploadsResponse.Bucket = bucket
listMultipartUploadsResponse.Delimiter = metadata.Delimiter
Expand All @@ -199,7 +199,7 @@ func generateListMultipartUploadsResponse(bucket string, metadata donut.BucketMu
for _, upload := range metadata.Upload {
newUpload := &Upload{}
newUpload.UploadID = upload.UploadID
newUpload.Key = upload.Key
newUpload.Key = upload.Object
newUpload.Initiated = upload.Initiated.Format(rfcFormat)
listMultipartUploadsResponse.Upload = append(listMultipartUploadsResponse.Upload, newUpload)
}
Expand Down
Loading

0 comments on commit 762b798

Please sign in to comment.