-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[server][fc] Integrate server side handlers with gRPC service + mTLS (#…
…565) - Adapts Netty Channel pipeline and corresponding handler classes to be compatible with gRPC requests - Can collect server side statistics and enforce read quota for gRPC requests - Introduce mutual TLS support on gRPC enabled servers and fast client, when an SSLFactory is present - Update unit tests and integration tests
- Loading branch information
Showing
57 changed files
with
2,987 additions
and
657 deletions.
There are no files selected for viewing
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
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
71 changes: 71 additions & 0 deletions
71
clients/venice-client/src/main/java/com/linkedin/venice/fastclient/GrpcClientConfig.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,71 @@ | ||
package com.linkedin.venice.fastclient; | ||
|
||
import com.linkedin.r2.transport.common.Client; | ||
import com.linkedin.venice.security.SSLFactory; | ||
import java.util.Map; | ||
|
||
|
||
public class GrpcClientConfig { | ||
// Use r2Client for non-storage related requests (not implemented in gRPC yet) | ||
private final Client r2Client; | ||
// require a map from netty server to grpc address due to lack of gRPC service discovery | ||
private final Map<String, String> nettyServerToGrpcAddressMap; | ||
// SSL Factory required if using SSL | ||
private final SSLFactory sslFactory; | ||
|
||
public GrpcClientConfig(Builder builder) { | ||
this.r2Client = builder.r2Client; | ||
this.nettyServerToGrpcAddressMap = builder.nettyServerToGrpcAddressMap; | ||
this.sslFactory = builder.sslFactory; | ||
} | ||
|
||
public Client getR2Client() { | ||
return r2Client; | ||
} | ||
|
||
public Map<String, String> getNettyServerToGrpcAddressMap() { | ||
return nettyServerToGrpcAddressMap; | ||
} | ||
|
||
public SSLFactory getSslFactory() { | ||
return sslFactory; | ||
} | ||
|
||
public static class Builder { | ||
private Client r2Client = null; | ||
private Map<String, String> nettyServerToGrpcAddressMap = null; | ||
private SSLFactory sslFactory = null; | ||
|
||
public Builder setR2Client(Client r2Client) { | ||
this.r2Client = r2Client; | ||
return this; | ||
} | ||
|
||
public Builder setNettyServerToGrpcAddressMap(Map<String, String> nettyServerToGrpcAddressMap) { | ||
this.nettyServerToGrpcAddressMap = nettyServerToGrpcAddressMap; | ||
return this; | ||
} | ||
|
||
public Builder setSSLFactory(SSLFactory sslFactory) { | ||
this.sslFactory = sslFactory; | ||
return this; | ||
} | ||
|
||
public GrpcClientConfig build() { | ||
verify(); | ||
return new GrpcClientConfig(this); | ||
} | ||
|
||
private void verify() { | ||
if (r2Client == null) { | ||
throw new IllegalArgumentException("R2 client must be set when enabling gRPC on FC"); | ||
} | ||
if (nettyServerToGrpcAddressMap == null) { | ||
throw new IllegalArgumentException("Netty server to grpc address map must be set"); | ||
} | ||
if (nettyServerToGrpcAddressMap.size() == 0) { | ||
throw new IllegalArgumentException("Netty server to grpc address map must not be empty"); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.