Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(storage): fix precondition comments #2813

Merged
merged 2 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion storage/objects/change_file_storage_class.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func changeObjectStorageClass(w io.Writer, bucket, object string) error {
o := client.Bucket(bucket).Object(object)

// Optional: set a generation-match precondition to avoid potential race
// conditions and data corruptions. The request to upload is aborted if the
// conditions and data corruptions. The request to copy is aborted if the
// object's generation number does not match your precondition.
attrs, err := o.Attrs(ctx)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion storage/objects/change_object_csek_to_cmek.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func сhangeObjectCSEKToKMS(w io.Writer, bucket, object string, encryptionKey []
o := client.Bucket(bucket).Object(object)

// Optional: set a generation-match precondition to avoid potential race
// conditions and data corruptions. The request to upload is aborted if the
// conditions and data corruptions. The request to copy is aborted if the
// object's generation number does not match your precondition.
attrs, err := o.Attrs(ctx)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion storage/objects/copy_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func copyFile(w io.Writer, dstBucket, srcBucket, srcObject string) error {
dst := client.Bucket(dstBucket).Object(dstObject)

// Optional: set a generation-match precondition to avoid potential race
// conditions and data corruptions. The request to upload is aborted if the
// conditions and data corruptions. The request to copy is aborted if the
// object's generation number does not match your precondition.
// For a dst object that does not yet exist, set the DoesNotExist precondition.
dst = dst.If(storage.Conditions{DoesNotExist: true})
Expand Down
2 changes: 1 addition & 1 deletion storage/objects/copy_file_archived_generation.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func copyOldVersionOfObject(w io.Writer, bucket, srcObject, dstObject string, ge
dst := client.Bucket(bucket).Object(dstObject)

// Optional: set a generation-match precondition to avoid potential race
// conditions and data corruptions. The request to upload is aborted if the
// conditions and data corruptions. The request to copy is aborted if the
// object's generation number does not match your precondition.
// For a dst object that does not yet exist, set the DoesNotExist precondition.
dst = dst.If(storage.Conditions{DoesNotExist: true})
Expand Down
4 changes: 2 additions & 2 deletions storage/objects/delete_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func deleteFile(w io.Writer, bucket, object string) error {
o := client.Bucket(bucket).Object(object)

// Optional: set a generation-match precondition to avoid potential race
// conditions and data corruptions. The request to upload is aborted if the
// object's generation number does not match your precondition.
// conditions and data corruptions. The request to delete the file is aborted
// if the object's generation number does not match your precondition.
attrs, err := o.Attrs(ctx)
if err != nil {
return fmt.Errorf("object.Attrs: %v", err)
Expand Down
4 changes: 2 additions & 2 deletions storage/objects/move_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ func moveFile(w io.Writer, bucket, object string) error {
dst := client.Bucket(bucket).Object(dstName)

// Optional: set a generation-match precondition to avoid potential race
// conditions and data corruptions. The request to upload is aborted if the
// object's generation number does not match your precondition.
// conditions and data corruptions. The request to copy the file is aborted
// if the object's generation number does not match your precondition.
// For a dst object that does not yet exist, set the DoesNotExist precondition.
dst = dst.If(storage.Conditions{DoesNotExist: true})
// If the destination object already exists in your bucket, set instead a
Expand Down
6 changes: 3 additions & 3 deletions storage/objects/release_event_based_hold.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ func releaseEventBasedHold(w io.Writer, bucket, object string) error {

o := client.Bucket(bucket).Object(object)

// Optional: set a generation-match precondition to avoid potential race
// conditions and data corruptions. The request to upload is aborted if the
// object's generation number does not match your precondition.
// Optional: set a metageneration-match precondition to avoid potential race
// conditions and data corruptions. The request to update is aborted if the
// object's metageneration does not match your precondition.
attrs, err := o.Attrs(ctx)
if err != nil {
return fmt.Errorf("object.Attrs: %v", err)
Expand Down
6 changes: 3 additions & 3 deletions storage/objects/release_temporary_hold.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ func releaseTemporaryHold(w io.Writer, bucket, object string) error {

o := client.Bucket(bucket).Object(object)

// Optional: set a generation-match precondition to avoid potential race
// conditions and data corruptions. The request to upload is aborted if the
// object's generation number does not match your precondition.
// Optional: set a metageneration-match precondition to avoid potential race
// conditions and data corruptions. The request to update is aborted if the
// object's metageneration does not match your precondition.
attrs, err := o.Attrs(ctx)
if err != nil {
return fmt.Errorf("object.Attrs: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion storage/objects/rotate_encryption_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func rotateEncryptionKey(w io.Writer, bucket, object string, key, newKey []byte)
o := client.Bucket(bucket).Object(object)

// Optional: set a generation-match precondition to avoid potential race
// conditions and data corruptions. The request to upload is aborted if the
// conditions and data corruptions. The request to copy is aborted if the
// object's generation number does not match your precondition.
attrs, err := o.Attrs(ctx)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions storage/objects/set_event_based_hold.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ func setEventBasedHold(w io.Writer, bucket, object string) error {

o := client.Bucket(bucket).Object(object)

// Optional: set a generation-match precondition to avoid potential race
// conditions and data corruptions. The request to upload is aborted if the
// object's generation number does not match your precondition.
// Optional: set a metageneration-match precondition to avoid potential race
// conditions and data corruptions. The request to update is aborted if the
// object's metageneration does not match your precondition.
attrs, err := o.Attrs(ctx)
if err != nil {
return fmt.Errorf("object.Attrs: %v", err)
Expand Down
6 changes: 3 additions & 3 deletions storage/objects/set_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ func setMetadata(w io.Writer, bucket, object string) error {

o := client.Bucket(bucket).Object(object)

// Optional: set a generation-match precondition to avoid potential race
// conditions and data corruptions. The request to upload is aborted if the
// object's generation number does not match your precondition.
// Optional: set a metageneration-match precondition to avoid potential race
// conditions and data corruptions. The request to update is aborted if the
// object's metageneration does not match your precondition.
attrs, err := o.Attrs(ctx)
if err != nil {
return fmt.Errorf("object.Attrs: %v", err)
Expand Down
6 changes: 3 additions & 3 deletions storage/objects/set_temporary_hold.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ func setTemporaryHold(w io.Writer, bucket, object string) error {

o := client.Bucket(bucket).Object(object)

// Optional: set a generation-match precondition to avoid potential race
// conditions and data corruptions. The request to upload is aborted if the
// object's generation number does not match your precondition.
// Optional: set a metageneration-match precondition to avoid potential race
// conditions and data corruptions. The request to update is aborted if the
// object's metageneration does not match your precondition.
attrs, err := o.Attrs(ctx)
if err != nil {
return fmt.Errorf("object.Attrs: %v", err)
Expand Down