Move mc to minio-go from objectstorage-go

This commit is contained in:
Harshavardhana
2015-05-23 16:10:58 -07:00
parent a8a61c982b
commit 9c136efa4d
27 changed files with 64 additions and 72 deletions
+4 -4
View File
@@ -31,12 +31,12 @@
"Rev": "432a1019ded42d1b34fb5f1aad60fb609245d5a1"
},
{
"ImportPath": "github.com/minio/minio/pkg/iodine",
"Rev": "0f58045480309d4b13fe45878f05736c3ff20e7e"
"ImportPath": "github.com/minio/minio-go",
"Rev": "eea7789129cfc58972977dd19c4729e2e559c8fc"
},
{
"ImportPath": "github.com/minio/objectstorage-go",
"Rev": "7e4b2520052fedcc40be93c93cbb13688d11285d"
"ImportPath": "github.com/minio/minio/pkg/iodine",
"Rev": "0f58045480309d4b13fe45878f05736c3ff20e7e"
},
{
"ImportPath": "github.com/shiena/ansicolor",
@@ -1,15 +1,12 @@
### Setup your objectstorage-go Github Repository
Fork [objectstorage-go upstream](https://github.com/minio/objectstorage-go/fork) source repository to your own personal repository.
### Setup your minio-go Github Repository
Fork [minio-go upstream](https://github.com/minio/minio-go/fork) source repository to your own personal repository.
```sh
$ git clone https://github.com/$USER_ID/objectstorage-go
$ cd objectstorage-go
$ make
$ objectstorage-go --help
$ godep get https://github.com/$USER_ID/minio-go
```
### Developer Guidelines
``objectstorage-go`` welcomes your contribution. To make the process as seamless as possible, we ask for the following:
``minio-go`` welcomes your contribution. To make the process as seamless as possible, we ask for the following:
* Go ahead and fork the project and make your changes. We encourage pull requests to discuss code changes.
- Fork it
@@ -18,11 +15,6 @@ $ objectstorage-go --help
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
* If you have additional dependencies for ``objectstorage-go``, ``objectstorage-go`` manages its depedencies using [godep](https://github.com/tools/godep)
- Run `go get foo/bar`
- Edit your code to import foo/bar
- Run `make save` from top-level directory (or `godep restore && godep save ./...`).
* When you're ready to create a pull request, be sure to:
- Have test cases for the new code. If you have questions about how to do it, please ask in your pull request.
- Run `go fmt`
@@ -30,5 +22,5 @@ $ objectstorage-go --help
- Make sure `go test -race ./...` and `go build` completes.
* Read [Effective Go](https://github.com/golang/go/wiki/CodeReviewComments) article from Golang project
- `objectstorage-go` project is strictly conformant with Golang style
- `minio-go` project is strictly conformant with Golang style
- if you happen to observe offending code, please feel free to send a pull request
@@ -1,16 +1,16 @@
# Minimal object storage library in Go
[![Build Status](https://travis-ci.org/minio/objectstorage-go.svg)](https://travis-ci.org/minio/objectstorage-go)
[![Build Status](https://travis-ci.org/minio/minio-go.svg)](https://travis-ci.org/minio/minio-go)
## Install
```go
# go get github.com/minio/objectstorage-go
# go get github.com/minio/minio-go
```
## Documentation
[Objectstorage library in Go](http://godoc.org/github.com/minio/objectstorage-go)
[Minimal object storage library in Go](http://godoc.org/github.com/minio/minio-go)
## Join Community
* Community hangout on Gitter [![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)
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package objectstorage
package client
import (
"errors"
@@ -132,7 +132,7 @@ type Config struct {
AcceptType string // specify this to get server response in non XML style if server supports it
Transport http.RoundTripper // custom transport usually for debugging, by default its nil
// internal
// use AddUserAgent append to default, useful when objectstorage-go is used with in your application
// use AddUserAgent append to default, useful when minio-go is used with in your application
userAgent string
}
@@ -173,7 +173,7 @@ func (c *Config) AddUserAgent(name string, version string, comments ...string) {
// Global constants
const (
LibraryName = "objectstorage-go"
LibraryName = "minio-go"
LibraryVersion = "0.1"
)
@@ -596,7 +596,7 @@ func (a *api) listObjectsInRoutine(bucket, prefix string, recursive bool, ch cha
// If you enable recursive as 'true' this function will return back all the objects in a given bucket
//
// eg:-
// api := objectstorage.New(....)
// api := client.New(....)
// for message := range api.ListObjects("mytestbucket", "starthere", true) {
// fmt.Println(message.Data)
// }
@@ -635,7 +635,7 @@ func (a *api) listBucketsInRoutine(ch chan BucketOnChannel) {
// requests are allowed for listing buckets
//
// eg:-
// api := objectstorage.New(....)
// api := client.New(....)
// for message := range api.ListBuckets() {
// fmt.Println(message.Data)
// }
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package objectstorage
package client
// bucketHandler is an http.Handler that verifies bucket responses and validates incoming requests
import (
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package objectstorage
package client
import (
"bytes"
@@ -23,16 +23,16 @@ import (
"log"
"os"
"github.com/minio/objectstorage-go"
play "github.com/minio/minio-go"
)
func main() {
config := new(objectstorage.Config)
config := new(play.Config)
config.AccessKeyID = ""
config.SecretAccessKey = ""
config.Endpoint = "http://play.minio.io:9000"
config.AcceptType = ""
m := objectstorage.New(config)
m := play.New(config)
reader, size, _, err := m.GetObject("testbucket", "testfile", 0, 0)
if err != nil {
log.Println(err)
@@ -21,16 +21,16 @@ package main
import (
"log"
"github.com/minio/objectstorage-go"
play "github.com/minio/minio-go"
)
func main() {
config := new(objectstorage.Config)
config := new(play.Config)
config.AccessKeyID = ""
config.SecretAccessKey = ""
config.Endpoint = "http://play.minio.io:9000"
config.AcceptType = ""
m := objectstorage.New(config)
m := play.New(config)
for message := range m.ListBuckets() {
if message.Err != nil {
log.Fatal(message.Err)
@@ -21,16 +21,16 @@ package main
import (
"log"
"github.com/minio/objectstorage-go"
play "github.com/minio/minio-go"
)
func main() {
config := new(objectstorage.Config)
config := new(play.Config)
config.AccessKeyID = ""
config.SecretAccessKey = ""
config.Endpoint = "http://play.minio.io:9000"
config.AcceptType = ""
m := objectstorage.New(config)
m := play.New(config)
for message := range m.ListObjects("public-bucket", "", true) {
if message.Err != nil {
log.Fatal(message.Err)
@@ -22,16 +22,16 @@ import (
"log"
"os"
"github.com/minio/objectstorage-go"
play "github.com/minio/minio-go"
)
func main() {
config := new(objectstorage.Config)
config := new(play.Config)
config.AccessKeyID = ""
config.SecretAccessKey = ""
config.Endpoint = "http://play.minio.io:9000"
config.AcceptType = ""
m := objectstorage.New(config)
m := play.New(config)
object, err := os.Open("testfile")
if err != nil {
log.Fatalln(err)
@@ -23,16 +23,16 @@ import (
"log"
"os"
"github.com/minio/objectstorage-go"
s3 "github.com/minio/minio-go"
)
func main() {
config := new(objectstorage.Config)
config := new(s3.Config)
config.AccessKeyID = ""
config.SecretAccessKey = ""
config.Endpoint = "https://s3.amazonaws.com"
config.AcceptType = ""
m := objectstorage.New(config)
m := s3.New(config)
reader, size, _, err := m.GetObject("testbucket", "testfile", 0, 0)
if err != nil {
log.Println(err)
@@ -21,16 +21,16 @@ package main
import (
"log"
"github.com/minio/objectstorage-go"
s3 "github.com/minio/minio-go"
)
func main() {
config := new(objectstorage.Config)
config := new(s3.Config)
config.AccessKeyID = ""
config.SecretAccessKey = ""
config.Endpoint = "https://s3.amazonaws.com"
config.AcceptType = ""
m := objectstorage.New(config)
m := s3.New(config)
for message := range m.ListBuckets() {
if message.Err != nil {
log.Fatal(message.Err)
@@ -21,16 +21,16 @@ package main
import (
"log"
"github.com/minio/objectstorage-go"
s3 "github.com/minio/minio-go"
)
func main() {
config := new(objectstorage.Config)
config := new(s3.Config)
config.AccessKeyID = ""
config.SecretAccessKey = ""
config.Endpoint = "https://s3.amazonaws.com"
config.AcceptType = ""
m := objectstorage.New(config)
m := s3.New(config)
for message := range m.ListObjects("public-bucket", "", true) {
if message.Err != nil {
log.Fatal(message.Err)
@@ -21,16 +21,16 @@ package main
import (
"log"
"github.com/minio/objectstorage-go"
s3 "github.com/minio/minio-go"
)
func main() {
config := new(objectstorage.Config)
config := new(s3.Config)
config.AccessKeyID = ""
config.SecretAccessKey = ""
config.Region = "us-east-1"
config.AcceptType = ""
m := objectstorage.New(config)
m := s3.New(config)
for err := range m.MultipartAbortAll("testbucket") {
if err != nil {
log.Fatal(err)
@@ -22,16 +22,16 @@ import (
"log"
"os"
"github.com/minio/objectstorage-go"
s3 "github.com/minio/minio-go"
)
func main() {
config := new(objectstorage.Config)
config := new(s3.Config)
config.AccessKeyID = ""
config.SecretAccessKey = ""
config.Endpoint = "https://s3.amazonaws.com"
config.AcceptType = ""
m := objectstorage.New(config)
m := s3.New(config)
object, err := os.Open("testfile")
if err != nil {
log.Fatalln(err)
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package objectstorage
package client
import (
"bytes"
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package objectstorage
package client
import (
"crypto/hmac"
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package objectstorage
package client
import "time"
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package objectstorage
package client
import (
"encoding/xml"
@@ -1,4 +1,4 @@
package objectstorage
package client
import (
"bytes"
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package objectstorage
package client
import (
"bytes"
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package objectstorage
package client
import (
"bytes"
+11 -11
View File
@@ -24,8 +24,8 @@ import (
"time"
"github.com/minio/mc/pkg/client"
s3 "github.com/minio/minio-go"
"github.com/minio/minio/pkg/iodine"
"github.com/minio/objectstorage-go"
)
// Config - see http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html
@@ -50,7 +50,7 @@ type TLSConfig struct {
}
type s3Client struct {
api objectstorage.API
api s3.API
hostURL *client.URL
}
@@ -86,14 +86,14 @@ func New(config *Config) (client.Client, error) {
default:
transport = http.DefaultTransport
}
objectstorageConf := new(objectstorage.Config)
objectstorageConf.AccessKeyID = config.AccessKeyID
objectstorageConf.SecretAccessKey = config.SecretAccessKey
objectstorageConf.Transport = transport
objectstorageConf.AddUserAgent(config.AppName, config.AppVersion, config.AppComments...)
objectstorageConf.Region = getRegion(u.Host)
objectstorageConf.Endpoint = u.Scheme + "://" + u.Host
api := objectstorage.New(objectstorageConf)
s3Conf := new(s3.Config)
s3Conf.AccessKeyID = config.AccessKeyID
s3Conf.SecretAccessKey = config.SecretAccessKey
s3Conf.Transport = transport
s3Conf.AddUserAgent(config.AppName, config.AppVersion, config.AppComments...)
s3Conf.Region = getRegion(u.Host)
s3Conf.Endpoint = u.Scheme + "://" + u.Host
api := s3.New(s3Conf)
return &s3Client{api: api, hostURL: u}, nil
}
@@ -114,7 +114,7 @@ func (c *s3Client) PutObject(size uint64, data io.Reader) error {
// invidual parts are properly verified
bucket, object := c.url2BucketAndObject()
// TODO - bump individual part size from default, if needed
// objectstorage.DefaultPartSize = 1024 * 1024 * 100
// s3.DefaultPartSize = 1024 * 1024 * 100
err := c.api.PutObject(bucket, object, size, data)
if err != nil {
return iodine.New(err, nil)