-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[controller] Add StoreGrpcService for store related gRPC endpoints an…
…d reduce boilerplate Add checkResourceCleanupForStoreCreation to gRPC Move create store to store grpc service
- Loading branch information
1 parent
5a81893
commit 7442860
Showing
30 changed files
with
1,470 additions
and
460 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
...ommon/src/main/java/com/linkedin/venice/exceptions/VeniceUnauthorizedAccessException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.linkedin.venice.exceptions; | ||
|
||
public class VeniceUnauthorizedAccessException extends VeniceException { | ||
public VeniceUnauthorizedAccessException(String message) { | ||
super(message); | ||
} | ||
|
||
public VeniceUnauthorizedAccessException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
internal/venice-common/src/main/proto/controller/ControllerGrpcRequestContext.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
syntax = 'proto3'; | ||
package com.linkedin.venice.protocols.controller; | ||
|
||
import "google/rpc/status.proto"; | ||
import "google/rpc/error_details.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
option java_multiple_files = true; | ||
|
||
message ClusterStoreGrpcInfo { | ||
string clusterName = 1; | ||
string storeName = 2; | ||
} | ||
|
||
enum ControllerGrpcErrorType { | ||
UNKNOWN = 0; | ||
INCORRECT_CONTROLLER = 1; | ||
INVALID_SCHEMA = 2; | ||
INVALID_CONFIG = 3; | ||
STORE_NOT_FOUND = 4; | ||
SCHEMA_NOT_FOUND = 5; | ||
CONNECTION_ERROR = 6; | ||
GENERAL_ERROR = 7; | ||
BAD_REQUEST = 8; | ||
CONCURRENT_BATCH_PUSH = 9; | ||
RESOURCE_STILL_EXISTS = 10; | ||
UNAUTHORIZED = 11; | ||
} | ||
|
||
message VeniceControllerGrpcErrorInfo { | ||
uint32 statusCode = 1; | ||
string errorMessage = 2; | ||
optional ControllerGrpcErrorType errorType = 3; | ||
optional string clusterName = 4; | ||
optional string storeName = 5; | ||
} |
61 changes: 61 additions & 0 deletions
61
internal/venice-common/src/main/proto/controller/StoreGrpcService.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
syntax = 'proto3'; | ||
package com.linkedin.venice.protocols.controller; | ||
|
||
|
||
import "controller/ControllerGrpcRequestContext.proto"; | ||
|
||
option java_multiple_files = true; | ||
|
||
service StoreGrpcService { | ||
rpc createStore(CreateStoreGrpcRequest) returns (CreateStoreGrpcResponse); | ||
rpc updateAclForStore(UpdateAclForStoreGrpcRequest) returns (UpdateAclForStoreGrpcResponse); | ||
rpc getAclForStore(GetAclForStoreGrpcRequest) returns (GetAclForStoreGrpcResponse); | ||
rpc deleteAclForStore(DeleteAclForStoreGrpcRequest) returns (DeleteAclForStoreGrpcResponse); | ||
rpc checkResourceCleanupForStoreCreation(ClusterStoreGrpcInfo) returns (ResourceCleanupCheckGrpcResponse) {} | ||
} | ||
|
||
message CreateStoreGrpcRequest { | ||
ClusterStoreGrpcInfo storeInfo = 1; | ||
string keySchema = 2; | ||
string valueSchema = 3; | ||
optional string owner = 4; | ||
optional bool isSystemStore = 5; | ||
optional string accessPermission = 6; | ||
} | ||
|
||
message CreateStoreGrpcResponse { | ||
ClusterStoreGrpcInfo storeInfo = 1; | ||
string owner = 2; | ||
} | ||
|
||
message UpdateAclForStoreGrpcRequest { | ||
ClusterStoreGrpcInfo storeInfo = 1; | ||
string accessPermissions = 3; | ||
} | ||
|
||
message UpdateAclForStoreGrpcResponse { | ||
ClusterStoreGrpcInfo storeInfo = 1; | ||
} | ||
|
||
message GetAclForStoreGrpcRequest { | ||
ClusterStoreGrpcInfo storeInfo = 1; | ||
} | ||
|
||
message GetAclForStoreGrpcResponse { | ||
ClusterStoreGrpcInfo storeInfo = 1; | ||
string accessPermissions = 2; | ||
} | ||
|
||
message DeleteAclForStoreGrpcRequest { | ||
ClusterStoreGrpcInfo storeInfo = 1; | ||
} | ||
|
||
message DeleteAclForStoreGrpcResponse { | ||
ClusterStoreGrpcInfo storeInfo = 1; | ||
} | ||
|
||
message ResourceCleanupCheckGrpcResponse { | ||
ClusterStoreGrpcInfo storeInfo = 1; | ||
bool hasLingeringResources = 2; | ||
optional string description = 3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...n/src/test/java/com/linkedin/venice/exceptions/VeniceUnauthorizedAccessExceptionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.linkedin.venice.exceptions; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
import static org.testng.Assert.assertNotNull; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
|
||
public class VeniceUnauthorizedAccessExceptionTest { | ||
@Test | ||
public void testExceptionWithMessage() { | ||
String message = "Unauthorized access to the resource"; | ||
VeniceUnauthorizedAccessException exception = new VeniceUnauthorizedAccessException(message); | ||
|
||
assertNotNull(exception); | ||
assertEquals(exception.getMessage(), message); | ||
} | ||
|
||
@Test | ||
public void testExceptionWithMessageAndCause() { | ||
String message = "Unauthorized access due to invalid credentials"; | ||
Throwable cause = new RuntimeException("Invalid credentials"); | ||
VeniceUnauthorizedAccessException exception = new VeniceUnauthorizedAccessException(message, cause); | ||
|
||
assertNotNull(exception); | ||
assertEquals(exception.getMessage(), message); | ||
assertEquals(exception.getCause(), cause); | ||
} | ||
} |
Oops, something went wrong.