Skip to content

Commit

Permalink
Renaming GetObject to GetPartialObject
Browse files Browse the repository at this point in the history
  • Loading branch information
fkautz committed Jun 11, 2015
1 parent 071376d commit 398964b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func main() {
## Documentation

* [PutObject(string, string, int64, io.Reader) error](examples/s3/putobject.go)
* [GetObject(string, string, int64, int64](examples/s3/getobject.go)
* [GetObject(string, string](examples/s3/getobject.go)
* [ListObjects(string, string, bool) <-chan](examples/s3/listobjects.go)
* [ListBuckets() <-chan](examples/s3/listbuckets.go)

Expand Down
11 changes: 6 additions & 5 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type BucketAPI interface {

// ObjectAPI - object specific Read/Write/Stat interface
type ObjectAPI interface {
GetObject(bucket, object string, offset, length int64) (io.ReadCloser, ObjectStat, error)
GetPartialObject(bucket, object string, offset, length int64) (io.ReadCloser, ObjectStat, error)
PutObject(bucket, object string, size int64, data io.Reader) error
StatObject(bucket, object string) (ObjectStat, error)
RemoveObject(bucket, object string) error
Expand Down Expand Up @@ -181,13 +181,14 @@ func New(config Config) (API, error) {

/// Object operations

// GetObject retrieve object
// GetPartialObject retrieve object
//
// Additionally it also takes range arguments to download the specified range bytes of an object.
// Takes range arguments to download the specified range bytes of an object.
// Setting offset and length = 0 will download the full object.
// For more information about the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
func (a api) GetObject(bucket, object string, offset, length int64) (io.ReadCloser, ObjectStat, error) {
func (a api) GetPartialObject(bucket, object string, offset, length int64) (io.ReadCloser, ObjectStat, error) {
// get the the object
return a.getObject(bucket, object, offset, length)
return a.getPartialObject(bucket, object, offset, length)
}

// completedParts is a wrapper to make parts sortable by their part number
Expand Down
2 changes: 1 addition & 1 deletion api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestObjectOperations(t *testing.T) {
t.Fatalf("Error")
}

reader, metadata, err := a.GetObject("bucket", "object", 0, 0)
reader, metadata, err := a.GetPartialObject("bucket", "object", 0, 0)
if err != nil {
t.Fatalf("Error")
}
Expand Down
2 changes: 1 addition & 1 deletion examples/play/getobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func main() {
if err != nil {
log.Fatalln(err)
}
reader, stat, err := playClient.GetObject("mybucket", "myobject", 0, 0)
reader, stat, err := playClient.GetPartialObject("mybucket", "myobject", 0, 0)
if err != nil {
log.Fatalln(err)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/s3/getobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func main() {
if err != nil {
log.Fatalln(err)
}
reader, stat, err := s3Client.GetObject("mybucket", "myobject", 0, 0)
reader, stat, err := s3Client.GetPartialObject("mybucket", "myobject", 0, 0)
if err != nil {
log.Fatalln(err)
}
Expand Down
5 changes: 3 additions & 2 deletions lowlevelapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,12 @@ func (a lowLevelAPI) getObjectRequest(bucket, object string, offset, length int6
return r, nil
}

// getObject - retrieve object from Object Storage
// getPartialObject - retrieve object from Object Storage
//
// Additionally it also takes range arguments to download the specified range bytes of an object.
// Setting offset and length = 0 will download the full object.
// For more information about the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
func (a lowLevelAPI) getObject(bucket, object string, offset, length int64) (io.ReadCloser, ObjectStat, error) {
func (a lowLevelAPI) getPartialObject(bucket, object string, offset, length int64) (io.ReadCloser, ObjectStat, error) {
if err := invalidArgumentToError(object); err != nil {
return nil, ObjectStat{}, err
}
Expand Down

0 comments on commit 398964b

Please sign in to comment.