[PR #1174] [MERGED] Add Bucket Attributes #1259

Closed
opened 2026-03-03 12:33:47 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fsouza/fake-gcs-server/pull/1174
Author: @RachitSharma2001
Created: 5/19/2023
Status: Merged
Merged: 7/29/2023
Merged by: @fsouza

Base: mainHead: main


📝 Commits (7)

  • 142e506 Change
  • 5543ff9 Done with BucketAttrsUpdate
  • 911fe32 Add UpdateBucket to GRPC
  • 85dd497 Clean code with Gofumpt
  • 117b8b0 Fixed lint errors
  • cc19c02 Delete Unnecessary files
  • 68c6030 Add specific data struct and error handling for update bucket attributes

📊 Changes

14 files changed (+406 additions, -123 deletions)

View changed files

📝 fakestorage/bucket.go (+37 -7)
📝 fakestorage/bucket_test.go (+54 -0)
📝 fakestorage/response.go (+14 -12)
📝 fakestorage/server.go (+1 -0)
📝 fakestorage/server_test.go (+2 -2)
📝 genproto/googleapis/storage/v1/storage.pb.go (+106 -62)
📝 genproto/googleapis/storage/v1/storage_resources.pb.go (+1 -1)
📝 internal/backend/backend_test.go (+67 -7)
📝 internal/backend/bucket.go (+11 -3)
📝 internal/backend/fs.go (+49 -10)
📝 internal/backend/memory.go (+20 -9)
📝 internal/backend/storage.go (+2 -1)
📝 internal/grpc/server.go (+14 -5)
📝 internal/grpc/server_test.go (+28 -4)

📄 Description

Addresses #1025

Allows for the storage, retrieval, and update of bucket attributes. So far, the only bucket attributes that are added are versioningEnabled and defaultEventBasedHolds. In addition, versioningEnabled cannot be updated within the file system, since the file system does not support it.

Relevant changes to the backend:

  1. Added BucketAttributes struct -> internal/backend/bucket.go
  2. Changed CreateBucket of filesystem and memory to take in bucket attributes -> internal/backend/fs.go and internal/backend/memory.go
  3. Added UpdateBucket method -> internal/backend/fs.go and internal/backend/memory.go

Relevant changes to fakestorage:

  1. Added updateBucket endpoint -> bucket.go and response.go

Relevant changes to GRPC:

  1. Added UpdateBucket endpoint -> internal/grpc/server.go
  2. Changed InsertBucket to allow the setting of defaultEventBasedHold -> internal/grpc/server.go

Relevant tests:
internal/backend/backend_tests.go -> TestBucketAttrsStoreRetrieveUpdate, TestBucketAttrsUpdateVersioning
fakestorage/bucket_test.go -> TestServerClientStoreAndRetrieveBucketAttrs, TestServerClientUpdateBucketAttrs
internal/grpc/server_test.go -> TestBucketInsertGetListUpdateDelete


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fsouza/fake-gcs-server/pull/1174 **Author:** [@RachitSharma2001](https://github.com/RachitSharma2001) **Created:** 5/19/2023 **Status:** ✅ Merged **Merged:** 7/29/2023 **Merged by:** [@fsouza](https://github.com/fsouza) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (7) - [`142e506`](https://github.com/fsouza/fake-gcs-server/commit/142e506ad9af0059999f270007f50d1620112d76) Change - [`5543ff9`](https://github.com/fsouza/fake-gcs-server/commit/5543ff91dbd8f8398afefe79f0837360ba74e20b) Done with BucketAttrsUpdate - [`911fe32`](https://github.com/fsouza/fake-gcs-server/commit/911fe3210ebb9fd5522f4bf2675e74dd79f80e41) Add UpdateBucket to GRPC - [`85dd497`](https://github.com/fsouza/fake-gcs-server/commit/85dd497d4bb0f8dbd6454f2ddc986663ca974375) Clean code with Gofumpt - [`117b8b0`](https://github.com/fsouza/fake-gcs-server/commit/117b8b033c364c86f4725c858793d04a263f6e64) Fixed lint errors - [`cc19c02`](https://github.com/fsouza/fake-gcs-server/commit/cc19c02d24f0784347a6dec67ad37d9676992740) Delete Unnecessary files - [`68c6030`](https://github.com/fsouza/fake-gcs-server/commit/68c60306dad03ac746671fa9943c52770b28209f) Add specific data struct and error handling for update bucket attributes ### 📊 Changes **14 files changed** (+406 additions, -123 deletions) <details> <summary>View changed files</summary> 📝 `fakestorage/bucket.go` (+37 -7) 📝 `fakestorage/bucket_test.go` (+54 -0) 📝 `fakestorage/response.go` (+14 -12) 📝 `fakestorage/server.go` (+1 -0) 📝 `fakestorage/server_test.go` (+2 -2) 📝 `genproto/googleapis/storage/v1/storage.pb.go` (+106 -62) 📝 `genproto/googleapis/storage/v1/storage_resources.pb.go` (+1 -1) 📝 `internal/backend/backend_test.go` (+67 -7) 📝 `internal/backend/bucket.go` (+11 -3) 📝 `internal/backend/fs.go` (+49 -10) 📝 `internal/backend/memory.go` (+20 -9) 📝 `internal/backend/storage.go` (+2 -1) 📝 `internal/grpc/server.go` (+14 -5) 📝 `internal/grpc/server_test.go` (+28 -4) </details> ### 📄 Description Addresses #1025 Allows for the storage, retrieval, and update of bucket attributes. So far, the only bucket attributes that are added are `versioningEnabled` and `defaultEventBasedHolds`. In addition, `versioningEnabled` cannot be updated within the file system, since the file system does not support it. Relevant changes to the backend: 1. Added `BucketAttributes` struct -> `internal/backend/bucket.go` 2. Changed `CreateBucket` of filesystem and memory to take in bucket attributes -> `internal/backend/fs.go` and `internal/backend/memory.go` 3. Added `UpdateBucket` method ->` internal/backend/fs.go` and `internal/backend/memory.go` Relevant changes to fakestorage: 1. Added `updateBucket `endpoint -> `bucket.go` and `response.go` Relevant changes to GRPC: 1. Added `UpdateBucket` endpoint ->` internal/grpc/server.go` 2. Changed `InsertBucket` to allow the setting of defaultEventBasedHold -> `internal/grpc/server.go` Relevant tests: internal/backend/backend_tests.go -> `TestBucketAttrsStoreRetrieveUpdate`, `TestBucketAttrsUpdateVersioning` fakestorage/bucket_test.go -> `TestServerClientStoreAndRetrieveBucketAttrs`, `TestServerClientUpdateBucketAttrs` internal/grpc/server_test.go -> `TestBucketInsertGetListUpdateDelete` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 12:33:47 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#1259
No description provided.