diff --git a/generated.go b/generated.go index b3774ab..47fff66 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,39 +19,6 @@ var _ httpclient.Options // Type is the type for gcs const Type = "gcs" -// ObjectMetadata stores service metadata for object. -// -// Deprecated: Use ObjectSystemMetadata instead. -type ObjectMetadata struct { - // EncryptionKeySha256 - EncryptionKeySha256 string - // StorageClass - StorageClass string -} - -// 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 { // EncryptionKeySha256 @@ -218,22 +183,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 @@ -513,30 +462,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. @@ -1026,6 +951,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() @@ -1033,6 +964,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) @@ -1126,6 +1063,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() @@ -1133,6 +1077,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 2c5b1eb..8f6e58d 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.15 require ( cloud.google.com/go/storage v1.15.0 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 golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1 google.golang.org/api v0.49.0 diff --git a/go.sum b/go.sum index ad2fef5..20932de 100644 --- a/go.sum +++ b/go.sum @@ -47,9 +47,9 @@ 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/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/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -90,8 +90,9 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -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/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=