[Controller] Add gRPC support for enableStore API #2429
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem Statement
As part of the controller gRPC migration, the
enableStoreAPI needs to be available via gRPC while maintaining the existing HTTP endpoint during the migration period. This follows the same pattern established by other controller API migrations, where business logic is abstracted so both HTTP and gRPC can share the same implementation.Solution
Added gRPC support for the
enableStoreAPI following the established migration pattern:StoreGrpcService.proto): AddedenableStoreRPC method withEnableStoreGrpcRequest,EnableStoreGrpcResponse, andStoreEnableOperationenum for operation types (READ, WRITE, READ_WRITE)StoreRequestHandler.java): AddedenableStore()method that validates parameters and calls the appropriate admin method based on operation typeStoreGrpcServiceImpl.java): AddedenableStore()override with ACL checks (matching HTTP endpoint behavior)StoresRoutes.java): Updated to convert HTTP requests to gRPC format and delegate to the shared handlerThe implementation reuses the existing business logic in
Admin.setStoreReadability(),Admin.setStoreWriteability(), andAdmin.setStoreReadWriteability(), ensuring consistency between HTTP and gRPC endpoints.Code changes
Concurrency-Specific Checks
Both reviewer and PR author to verify
synchronized,RWLock) are used where needed. (N/A - no shared mutable state)ConcurrentHashMap,CopyOnWriteArrayList). (N/A - no collections introduced)handleRequest()utility for consistent error handling)How was this PR tested?
testEnableStoreReadOperation- Verifies read operationtestEnableStoreWriteOperation- Verifies write operationtestEnableStoreReadWriteOperation- Verifies read-write operationtestEnableStoreUnspecifiedOperation- Verifies error for unspecified operationtestEnableStoreReturnsSuccessfulResponse- Verifies gRPC successtestEnableStoreReturnsErrorResponse- Verifies gRPC error handlingtestEnableStoreReturnsPermissionDenied- Verifies ACL enforcementtestEnableStoreGrpcEndpoint- End-to-end test for all operation typesDoes this PR introduce any user-facing or breaking changes?