diff --git a/generated.go b/generated.go index 3bbaca5..237bb6c 100644 --- a/generated.go +++ b/generated.go @@ -6,14 +6,12 @@ import ( "io" "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 -var _ endpoint.Value var _ Storager var _ services.ServiceError var _ httpclient.Options @@ -21,37 +19,6 @@ var _ httpclient.Options // Type is the type for kodo const Type = "kodo" -// ObjectMetadata stores service metadata for object. -// -// Deprecated: Use ObjectSystemMetadata instead. -type ObjectMetadata struct { - // StorageClass - StorageClass int -} - -// GetObjectMetadata will get ObjectMetadata from Object. -// -// - This function should not be called by service implementer. -// - The returning ObjectMetadata is read only and should not be modified. -// -// Deprecated: Use GetObjectSystemMetadata instead. -func GetObjectMetadata(o *Object) ObjectMetadata { - om, ok := o.GetServiceMetadata() - if ok { - return om.(ObjectMetadata) - } - return ObjectMetadata{} -} - -// setObjectMetadata will set ObjectMetadata into Object. -// -// - This function should only be called once, please make sure all data has been written before set. -// -// Deprecated: Use setObjectSystemMetadata instead. -func setObjectMetadata(o *Object, om ObjectMetadata) { - o.SetServiceMetadata(om) -} - // ObjectSystemMetadata stores system metadata for object. type ObjectSystemMetadata struct { // StorageClass @@ -179,22 +146,6 @@ var ( ) type ServiceFeatures struct { - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationAll bool - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationCreate bool - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationDelete bool - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationGet bool - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationList bool - - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - VirtualOperationAll bool - - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - VirtualPairAll bool } // pairServiceNew is the parsed struct @@ -483,30 +434,6 @@ var ( ) type StorageFeatures struct { - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationAll bool - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationCreate bool - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationCreateDir bool - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationDelete bool - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationList bool - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationMetadata bool - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationRead bool - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationStat bool - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - LooseOperationWrite bool - - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - VirtualOperationAll bool - - // Deprecated: This field has been deprecated by GSP-109, planned be removed in v4.3.0. - VirtualPairAll bool // VirtualDir virtual_dir feature is designed for a service that doesn't have native dir support but wants to provide simulated operations. // // - If this feature is disabled (the default behavior), the service will behave like it doesn't have any dir support. @@ -971,6 +898,12 @@ func (s *Storage) DeleteWithContext(ctx context.Context, path string, pairs ...P // List will return list a specific path. // +// ## Behavior +// +// - Service SHOULD support default `ListMode`. +// - Service SHOULD implement `ListModeDir` without the check for `VirtualDir`. +// - Service DON'T NEED to `Stat` while in `List`. +// // This function will create a context by default. func (s *Storage) List(path string, pairs ...Pair) (oi *ObjectIterator, err error) { ctx := context.Background() @@ -978,6 +911,12 @@ func (s *Storage) List(path string, pairs ...Pair) (oi *ObjectIterator, err erro } // ListWithContext will return list a specific path. +// +// ## Behavior +// +// - Service SHOULD support default `ListMode`. +// - Service SHOULD implement `ListModeDir` without the check for `VirtualDir`. +// - Service DON'T NEED to `Stat` while in `List`. func (s *Storage) ListWithContext(ctx context.Context, path string, pairs ...Pair) (oi *ObjectIterator, err error) { defer func() { err = s.formatError("list", err, path) @@ -1071,6 +1010,13 @@ func (s *Storage) StatWithContext(ctx context.Context, path string, pairs ...Pai // Write will write data into a file. // +// ## Behavior +// +// - Write SHOULD NOT return an error as the object exist. +// - Service that has native support for `overwrite` doesn't NEED to check the object exists or not. +// - Service that doesn't have native support for `overwrite` SHOULD check and delete the object if exists. +// - A successful write operation SHOULD be complete, which means the object's content and metadata should be the same as specified in write request. +// // This function will create a context by default. func (s *Storage) Write(path string, r io.Reader, size int64, pairs ...Pair) (n int64, err error) { ctx := context.Background() @@ -1078,6 +1024,13 @@ func (s *Storage) Write(path string, r io.Reader, size int64, pairs ...Pair) (n } // WriteWithContext will write data into a file. +// +// ## Behavior +// +// - Write SHOULD NOT return an error as the object exist. +// - Service that has native support for `overwrite` doesn't NEED to check the object exists or not. +// - Service that doesn't have native support for `overwrite` SHOULD check and delete the object if exists. +// - A successful write operation SHOULD be complete, which means the object's content and metadata should be the same as specified in write request. func (s *Storage) WriteWithContext(ctx context.Context, path string, r io.Reader, size int64, pairs ...Pair) (n int64, err error) { defer func() { err = s.formatError("write", err, path) diff --git a/go.mod b/go.mod index 8b66c05..a408561 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.15 require ( github.com/beyondstorage/go-endpoint v1.0.1 github.com/beyondstorage/go-integration-test/v4 v4.1.1 - github.com/beyondstorage/go-storage/v4 v4.2.0 + github.com/beyondstorage/go-storage/v4 v4.3.2 github.com/google/uuid v1.2.0 github.com/qiniu/go-sdk/v7 v7.9.6 ) diff --git a/go.sum b/go.sum index 8ee0a9b..801e48f 100644 --- a/go.sum +++ b/go.sum @@ -4,9 +4,9 @@ github.com/beyondstorage/go-endpoint v1.0.1 h1:F8x2dGLMu9je6g7zPbKoxCXDlug97K26S github.com/beyondstorage/go-endpoint v1.0.1/go.mod h1:P2hknaGrziOJJKySv/XnAiVw/d3v12/LZu2gSxEx4nM= github.com/beyondstorage/go-integration-test/v4 v4.1.1 h1:9bSXKbr6hLb4+ZsmAhWE32fvqhyrpub4U4qgBGeth4A= github.com/beyondstorage/go-integration-test/v4 v4.1.1/go.mod h1:ihtCaOJvaHGE0v+IhY6ZUF5NU1IND6xmdrJI9Lq/jhc= -github.com/beyondstorage/go-storage/v4 v4.2.0 h1:J0xqqy4qEQRtIS2zUWMA5wRXVHx/cxX5fHsU2ezA3+I= github.com/beyondstorage/go-storage/v4 v4.2.0/go.mod h1:rUNzOXcikYk5w0ewvNsKbztg7ndQDyDvjDuP0bznSLU= -github.com/beyondstorage/specs/go v0.0.0-20210623065218-d1c2d7d81259 h1:mW9XpHLc6pdXBRnsha1VlqF0rNsB/Oc+8l+5UYngmRA= +github.com/beyondstorage/go-storage/v4 v4.3.2 h1:F3xQVTcBJ+nSzEt/wBZCx4pE7aYhy43+tn1mwMYCacE= +github.com/beyondstorage/go-storage/v4 v4.3.2/go.mod h1:8FHjTUFuwLl/mmIGpOL9g3RTZPyye7vneFN/JkRj5Tg= github.com/beyondstorage/specs/go v0.0.0-20210623065218-d1c2d7d81259/go.mod h1:vF/Q0P1tCvhVAUrxg7i6NvrARRMQVTAuQdDNqpSzR1w= github.com/dave/dst v0.26.2 h1:lnxLAKI3tx7MgLNVDirFCsDTlTG9nKTk7GcptKcWSwY= github.com/dave/dst v0.26.2/go.mod h1:UMDJuIRPfyUCC78eFuB+SV/WI8oDeyFDvM/JR6NI3IU= @@ -17,8 +17,9 @@ github.com/dave/rebecca v0.9.1/go.mod h1:N6XYdMD/OKw3lkF3ywh8Z6wPGuwNFDNtWYEMFWE github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/golang/mock v1.5.0 h1:jlYHihg//f7RRwuPfptm04yp4s7O6Kw8EZiVYIGcH0g= github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/google/pprof v0.0.0-20181127221834-b4f47329b966/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -53,34 +54,46 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/arch v0.0.0-20180920145803-b19384d3c130/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5 h1:MeC2gMlMdkd67dn17MEby3rGXRxZtWeiRXOnISfTQ74= golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.1.1 h1:wGiQel/hW0NnEkJUk8lbzkX2gFJU6PFxf1v5OlCfuOs= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=