diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c78ee9..e861fcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/). - *: Add UnimplementedStub (#12) - tests: Introduce STORAGE_OSS_INTEGRATION_TEST (#13) - storage: Implement SSE support (#14) -- storage: Implement AOS-40 (#16) +- storage: Implement GSP-40 (#16) ### Changed @@ -30,4 +30,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/). - Implement oss services. -[v1.1.0]: https://github.com/aos-dev/go-service-oss/compare/v1.0.0...v1.1.0 +[v1.1.0]: https://github.com/beyondstorage/go-service-oss/compare/v1.0.0...v1.1.0 diff --git a/README.md b/README.md index 5183af4..4e03e95 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # go-services-oss -[![Build Status](https://github.com/aos-dev/go-service-oss/workflows/Unit%20Test/badge.svg?branch=master)](https://github.com/aos-dev/go-service-oss/actions?query=workflow%3A%22Unit+Test%22) +[![Build Status](https://github.com/beyondstorage/go-service-oss/workflows/Unit%20Test/badge.svg?branch=master)](https://github.com/beyondstorage/go-service-oss/actions?query=workflow%3A%22Unit+Test%22) [![License](https://img.shields.io/badge/license-apache%20v2-blue.svg)](https://github.com/Xuanwo/storage/blob/master/LICENSE) [![go storage dev](https://img.shields.io/matrix/go-service-oss:aos.dev.svg?server_fqdn=chat.aos.dev&label=%23go-service-oss%3Aaos.dev&logo=matrix)](https://matrix.to/#/#go-service-oss:aos.dev) -oss services support for [go-storage](https://github.com/aos-dev/go-storage) +oss services support for [go-storage](https://github.com/beyondstorage/go-storage) ## Install ```go -go get github.com/aos-dev/go-service-oss +go get github.com/beyondstorage/go-service-oss/v2 ``` diff --git a/doc.go b/doc.go index d4273fc..d647a67 100644 --- a/doc.go +++ b/doc.go @@ -3,4 +3,4 @@ Package oss provided support for Aliyun Object Storage Service (https://cn.aliyu */ package oss -//go:generate go run -tags tools github.com/aos-dev/go-storage/v3/cmd/definitions service.toml +//go:generate go run -tags tools github.com/beyondstorage/go-storage/v4/cmd/definitions service.toml diff --git a/generated.go b/generated.go index 780e608..faccea2 100644 --- a/generated.go +++ b/generated.go @@ -5,11 +5,11 @@ import ( "context" "io" - "github.com/aos-dev/go-storage/v3/pkg/credential" - "github.com/aos-dev/go-storage/v3/pkg/endpoint" - "github.com/aos-dev/go-storage/v3/pkg/httpclient" - "github.com/aos-dev/go-storage/v3/services" - . "github.com/aos-dev/go-storage/v3/types" + "github.com/beyondstorage/go-storage/v4/pkg/credential" + "github.com/beyondstorage/go-storage/v4/pkg/endpoint" + "github.com/beyondstorage/go-storage/v4/pkg/httpclient" + "github.com/beyondstorage/go-storage/v4/services" + . "github.com/beyondstorage/go-storage/v4/types" ) var _ credential.Provider @@ -1297,26 +1297,14 @@ func (s *Storage) ListMultipartWithContext(ctx context.Context, o *Object, pairs // Metadata will return current storager metadata. // // This function will create a context by default. -func (s *Storage) Metadata(pairs ...Pair) (meta *StorageMeta, err error) { - ctx := context.Background() - return s.MetadataWithContext(ctx, pairs...) -} - -// MetadataWithContext will return current storager metadata. -func (s *Storage) MetadataWithContext(ctx context.Context, pairs ...Pair) (meta *StorageMeta, err error) { - defer func() { - err = s.formatError("metadata", err) - }() - +func (s *Storage) Metadata(pairs ...Pair) (meta *StorageMeta) { pairs = append(pairs, s.defaultPairs.Metadata...) var opt pairStorageMetadata - opt, err = s.parsePairStorageMetadata(pairs) - if err != nil { - return - } + // Ignore error while handling local funtions. + opt, _ = s.parsePairStorageMetadata(pairs) - return s.metadata(ctx, opt) + return s.metadata(opt) } // Read will read the file's data. diff --git a/go.mod b/go.mod index f695336..4765bb8 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ -module github.com/aos-dev/go-service-oss +module github.com/beyondstorage/go-service-oss/v2 go 1.14 require ( github.com/aliyun/aliyun-oss-go-sdk v2.1.8+incompatible - github.com/aos-dev/go-integration-test/v3 v3.0.1-0.20210512065058-b6c8caf13bc6 - github.com/aos-dev/go-storage/v3 v3.6.1-0.20210513125055-cb9106d884d5 github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect + github.com/beyondstorage/go-integration-test/v4 v4.0.0-20210521062555-83f8f166943f + github.com/beyondstorage/go-storage/v4 v4.0.0-20210521045436-248353dfc077 github.com/google/uuid v1.2.0 github.com/satori/go.uuid v1.2.0 // indirect golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect diff --git a/go.sum b/go.sum index eefd123..dd13578 100644 --- a/go.sum +++ b/go.sum @@ -2,16 +2,14 @@ github.com/Xuanwo/templateutils v0.1.0 h1:WpkWOqQtIQ2vAIpJLa727DdN8WtxhUkkbDGa6U github.com/Xuanwo/templateutils v0.1.0/go.mod h1:OdE0DJ+CJxDBq6psX5DPV+gOZi8bhuHuVUpPCG++Wb8= github.com/aliyun/aliyun-oss-go-sdk v2.1.8+incompatible h1:hLUNPbx10wawWW7DeNExvTrlb90db3UnnNTFKHZEFhE= github.com/aliyun/aliyun-oss-go-sdk v2.1.8+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= -github.com/aos-dev/go-integration-test/v3 v3.0.1-0.20210512065058-b6c8caf13bc6 h1:73QZDkTGFyWpkWVrjs0GEM1VREyEmM7RtzddWtBYXho= -github.com/aos-dev/go-integration-test/v3 v3.0.1-0.20210512065058-b6c8caf13bc6/go.mod h1:iMlF4lL4WavgZezGscajjSNcUdFnacX8Dek6lhE0oJA= -github.com/aos-dev/go-storage/v3 v3.6.1-0.20210512033924-5adf27cfdf96/go.mod h1:6arAU5t7CXEsxDPs87xqgHmvEj8/GQfHlV61CxxC0Ww= -github.com/aos-dev/go-storage/v3 v3.6.1-0.20210513125055-cb9106d884d5 h1:xiJN6PvJPDDVac4Ha+ekuGUjRh49O1a1xwxrJPCwlto= -github.com/aos-dev/go-storage/v3 v3.6.1-0.20210513125055-cb9106d884d5/go.mod h1:qareAWtwrRlx4Fw6XIhtAbQnM7I3wylhaQ5Gr3Q5Geg= -github.com/aos-dev/specs/go v0.0.0-20210512024100-386a13f23a83/go.mod h1:gNah3KaPJEfysh7uCCX+sYjQC3g2yx2VgBkFlT945Ws= -github.com/aos-dev/specs/go v0.0.0-20210512093613-3e7634b4a7f5 h1:MmXROEim7Z9u1lFLRvZCy/yKBhq3k1Q/nvaVQmVvZUU= -github.com/aos-dev/specs/go v0.0.0-20210512093613-3e7634b4a7f5/go.mod h1:owye99eWsZvtg5kCEKtSp+AsRPsANhnXgCzHacu4icM= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f h1:ZNv7On9kyUzm7fvRZumSyy/IUiSC7AzL0I1jKKtwooA= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= +github.com/beyondstorage/go-integration-test/v4 v4.0.0-20210521062555-83f8f166943f h1:2a44nxIWm5DgEb6/gnD3We/32Bx19ET0iOM4+mxOmp8= +github.com/beyondstorage/go-integration-test/v4 v4.0.0-20210521062555-83f8f166943f/go.mod h1:PUhp+CDYnsysCKVU7poqIK7ZWTfADkOu2Z/PjlSIhsY= +github.com/beyondstorage/go-storage/v4 v4.0.0-20210521045436-248353dfc077 h1:BxqrLLELv6ZvP4+DZlwPAwBhNYkQqpZFvujvUT8zGiY= +github.com/beyondstorage/go-storage/v4 v4.0.0-20210521045436-248353dfc077/go.mod h1:oa2dYco+xplPj99WSBnYVw/xXvRkIKWSSVDQKNZ5Kz8= +github.com/beyondstorage/specs/go v0.0.0-20210521044836-3d41c1d9c97f h1:KMXKB/LACUmnOfLfjND8222qtzWT9lWRUdsPOlM4FqE= +github.com/beyondstorage/specs/go v0.0.0-20210521044836-3d41c1d9c97f/go.mod h1:f5VvmLHc/dNJwl+/yAv/TOHdev3phvuEswx8DIXiSQQ= github.com/dave/dst v0.26.2 h1:lnxLAKI3tx7MgLNVDirFCsDTlTG9nKTk7GcptKcWSwY= github.com/dave/dst v0.26.2/go.mod h1:UMDJuIRPfyUCC78eFuB+SV/WI8oDeyFDvM/JR6NI3IU= github.com/dave/gopackages v0.0.0-20170318123100-46e7023ec56e/go.mod h1:i00+b/gKdIDIxuLDFob7ustLAVqhsZRk2qVZrArELGQ= @@ -37,7 +35,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/pelletier/go-toml v1.9.0/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.1 h1:a6qW1EVNZWH9WGI6CsYdD8WAylkoXBS5yv0XHlh17Tc= github.com/pelletier/go-toml v1.9.1/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/iterator.go b/iterator.go index 3821d70..44f7a57 100644 --- a/iterator.go +++ b/iterator.go @@ -31,5 +31,5 @@ type partPageStatus struct { } func (i *partPageStatus) ContinuationToken() string { - return strconv.FormatInt(int64(i.partNumberMarker), 10) + return strconv.FormatInt(i.partNumberMarker, 10) } diff --git a/service.go b/service.go index 68361ae..5b72b71 100644 --- a/service.go +++ b/service.go @@ -4,8 +4,8 @@ import ( "context" "github.com/aliyun/aliyun-oss-go-sdk/oss" - ps "github.com/aos-dev/go-storage/v3/pairs" - typ "github.com/aos-dev/go-storage/v3/types" + ps "github.com/beyondstorage/go-storage/v4/pairs" + typ "github.com/beyondstorage/go-storage/v4/types" ) func (s *Service) create(ctx context.Context, name string, opt pairServiceCreate) (store typ.Storager, err error) { diff --git a/storage.go b/storage.go index b01e205..1a2fe83 100644 --- a/storage.go +++ b/storage.go @@ -8,10 +8,10 @@ import ( "github.com/aliyun/aliyun-oss-go-sdk/oss" - "github.com/aos-dev/go-storage/v3/pkg/headers" - "github.com/aos-dev/go-storage/v3/pkg/iowrap" - "github.com/aos-dev/go-storage/v3/services" - . "github.com/aos-dev/go-storage/v3/types" + "github.com/beyondstorage/go-storage/v4/pkg/headers" + "github.com/beyondstorage/go-storage/v4/pkg/iowrap" + "github.com/beyondstorage/go-storage/v4/services" + . "github.com/beyondstorage/go-storage/v4/types" ) func (s *Storage) commitAppend(ctx context.Context, o *Object, opt pairStorageCommitAppend) (err error) { @@ -143,7 +143,7 @@ func (s *Storage) delete(ctx context.Context, path string, opt pairStorageDelete }) if err != nil && checkError(err, responseCodeNoSuchUpload) { // Omit `NoSuchUpdate` error here - // ref: [AOS-46](https://github.com/aos-dev/specs/blob/master/rfcs/46-idempotent-delete.md) + // ref: [GSP-46](https://github.com/beyondstorage/specs/blob/master/rfcs/46-idempotent-delete.md) err = nil } if err != nil { @@ -155,7 +155,7 @@ func (s *Storage) delete(ctx context.Context, path string, opt pairStorageDelete // OSS DeleteObject is idempotent, so we don't need to check NoSuchKey error. // // References - // - [AOS-46](https://github.com/aos-dev/specs/blob/master/rfcs/46-idempotent-delete.md) + // - [GSP-46](https://github.com/beyondstorage/specs/blob/master/rfcs/46-idempotent-delete.md) // - https://help.aliyun.com/document_detail/31982.html err = s.bucket.DeleteObject(rp) if err != nil { @@ -197,7 +197,7 @@ func (s *Storage) listMultipart(ctx context.Context, o *Object, opt pairStorageL return NewPartIterator(ctx, s.nextPartPage, input), nil } -func (s *Storage) metadata(ctx context.Context, opt pairStorageMetadata) (meta *StorageMeta, err error) { +func (s *Storage) metadata(opt pairStorageMetadata) (meta *StorageMeta) { meta = NewStorageMeta() meta.Name = s.bucket.BucketName meta.WorkDir = s.workDir diff --git a/tests/storage_test.go b/tests/storage_test.go index 965ba81..4cbd418 100644 --- a/tests/storage_test.go +++ b/tests/storage_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - tests "github.com/aos-dev/go-integration-test/v3" + tests "github.com/beyondstorage/go-integration-test/v4" ) func TestStorage(t *testing.T) { diff --git a/tests/utils_test.go b/tests/utils_test.go index 5d8c260..6574b98 100644 --- a/tests/utils_test.go +++ b/tests/utils_test.go @@ -4,9 +4,9 @@ import ( "os" "testing" - oss "github.com/aos-dev/go-service-oss" - ps "github.com/aos-dev/go-storage/v3/pairs" - "github.com/aos-dev/go-storage/v3/types" + oss "github.com/beyondstorage/go-service-oss/v2" + ps "github.com/beyondstorage/go-storage/v4/pairs" + "github.com/beyondstorage/go-storage/v4/types" "github.com/google/uuid" ) diff --git a/tools.go b/tools.go index 967a389..0afb4e7 100644 --- a/tools.go +++ b/tools.go @@ -2,4 +2,4 @@ package oss -import _ "github.com/aos-dev/go-storage/v3/cmd/definitions" +import _ "github.com/beyondstorage/go-storage/v4/cmd/definitions" diff --git a/utils.go b/utils.go index 7d9acbb..8c2bd10 100644 --- a/utils.go +++ b/utils.go @@ -6,12 +6,12 @@ import ( "github.com/aliyun/aliyun-oss-go-sdk/oss" - ps "github.com/aos-dev/go-storage/v3/pairs" - "github.com/aos-dev/go-storage/v3/pkg/credential" - "github.com/aos-dev/go-storage/v3/pkg/endpoint" - "github.com/aos-dev/go-storage/v3/pkg/httpclient" - "github.com/aos-dev/go-storage/v3/services" - typ "github.com/aos-dev/go-storage/v3/types" + ps "github.com/beyondstorage/go-storage/v4/pairs" + "github.com/beyondstorage/go-storage/v4/pkg/credential" + "github.com/beyondstorage/go-storage/v4/pkg/endpoint" + "github.com/beyondstorage/go-storage/v4/pkg/httpclient" + "github.com/beyondstorage/go-storage/v4/services" + typ "github.com/beyondstorage/go-storage/v4/types" ) // Service is the aliyun oss *Service config. @@ -136,7 +136,7 @@ const ( ) func formatError(err error) error { - if _, ok := err.(services.AosError); ok { + if _, ok := err.(services.InternalError); ok { return err }