use of com.github.ambry.clustermap.ReplicaType in project ambry by linkedin.
the class RequestResponseTest method replicaMetadataRequestTest.
@Test
public void replicaMetadataRequestTest() throws IOException {
short oldMessageInfoVersion = MessageInfoAndMetadataListSerde.AUTO_VERSION;
for (ReplicaType replicaType : ReplicaType.values()) {
doReplicaMetadataRequestTest(ReplicaMetadataResponse.REPLICA_METADATA_RESPONSE_VERSION_V_6, ReplicaMetadataRequest.Replica_Metadata_Request_Version_V2, MessageInfoAndMetadataListSerde.VERSION_5, replicaType);
doReplicaMetadataRequestTest(ReplicaMetadataResponse.REPLICA_METADATA_RESPONSE_VERSION_V_6, ReplicaMetadataRequest.Replica_Metadata_Request_Version_V2, MessageInfoAndMetadataListSerde.VERSION_6, replicaType);
doReplicaMetadataRequestTest(ReplicaMetadataResponse.REPLICA_METADATA_RESPONSE_VERSION_V_4, ReplicaMetadataRequest.Replica_Metadata_Request_Version_V1, MessageInfoAndMetadataListSerde.VERSION_5, replicaType);
doReplicaMetadataRequestTest(ReplicaMetadataResponse.REPLICA_METADATA_RESPONSE_VERSION_V_5, ReplicaMetadataRequest.Replica_Metadata_Request_Version_V1, MessageInfoAndMetadataListSerde.VERSION_5, replicaType);
doReplicaMetadataRequestTest(ReplicaMetadataResponse.REPLICA_METADATA_RESPONSE_VERSION_V_5, ReplicaMetadataRequest.Replica_Metadata_Request_Version_V1, MessageInfoAndMetadataListSerde.VERSION_6, replicaType);
}
MessageInfoAndMetadataListSerde.AUTO_VERSION = oldMessageInfoVersion;
}
use of com.github.ambry.clustermap.ReplicaType in project ambry by linkedin.
the class CloudRouterFactory method getCompositeNetworkClientFactory.
/**
* @param requestHandlerPool the pool to connect to {@link LocalNetworkClientFactory}.
* @return a {@link CompositeNetworkClientFactory} that can be used to talk to cloud managed services or ambry server
* nodes.
*/
private CompositeNetworkClientFactory getCompositeNetworkClientFactory(RequestHandlerPool requestHandlerPool) {
NetworkClientFactory cloudNetworkClientFactory = new LocalNetworkClientFactory((LocalRequestResponseChannel) requestHandlerPool.getChannel(), networkConfig, networkMetrics, time);
NetworkClientFactory diskNetworkClientFactory = null;
if (routerConfig.routerEnableHttp2NetworkClient) {
diskNetworkClientFactory = new Http2NetworkClientFactory(http2ClientMetrics, http2ClientConfig, sslFactory, time);
} else {
diskNetworkClientFactory = new SocketNetworkClientFactory(networkMetrics, networkConfig, sslFactory, routerConfig.routerScalingUnitMaxConnectionsPerPortPlainText, routerConfig.routerScalingUnitMaxConnectionsPerPortSsl, routerConfig.routerConnectionCheckoutTimeoutMs, time);
}
Map<ReplicaType, NetworkClientFactory> childFactories = new EnumMap<>(ReplicaType.class);
childFactories.put(ReplicaType.CLOUD_BACKED, cloudNetworkClientFactory);
childFactories.put(ReplicaType.DISK_BACKED, diskNetworkClientFactory);
return new CompositeNetworkClientFactory(childFactories);
}
use of com.github.ambry.clustermap.ReplicaType in project ambry by linkedin.
the class CloudRouterTest method setRouter.
/**
* Initialize and set the router with the given {@link Properties} and {@link MockServerLayout}
* @param props the {@link Properties}
* @param notificationSystem the {@link NotificationSystem} to use.
*/
@Override
protected void setRouter(Properties props, MockServerLayout mockServerLayout, NotificationSystem notificationSystem) throws Exception {
VerifiableProperties verifiableProperties = new VerifiableProperties((props));
RouterConfig routerConfig = new RouterConfig(verifiableProperties);
routerMetrics = new NonBlockingRouterMetrics(mockClusterMap, routerConfig);
CloudConfig cloudConfig = new CloudConfig(verifiableProperties);
CloudDestinationFactory cloudDestinationFactory = Utils.getObj(cloudConfig.cloudDestinationFactoryClass, verifiableProperties, mockClusterMap.getMetricRegistry(), mockClusterMap);
CloudDestination cloudDestination = cloudDestinationFactory.getCloudDestination();
AccountService accountService = new InMemAccountService(false, true);
CloudRouterFactory cloudRouterFactory = new CloudRouterFactory(verifiableProperties, mockClusterMap, new LoggingNotificationSystem(), null, accountService);
RequestHandlerPool requestHandlerPool = cloudRouterFactory.getRequestHandlerPool(verifiableProperties, mockClusterMap, cloudDestination, cloudConfig);
Map<ReplicaType, NetworkClientFactory> childFactories = new EnumMap<>(ReplicaType.class);
childFactories.put(ReplicaType.CLOUD_BACKED, new LocalNetworkClientFactory((LocalRequestResponseChannel) requestHandlerPool.getChannel(), new NetworkConfig(verifiableProperties), new NetworkMetrics(routerMetrics.getMetricRegistry()), mockTime));
childFactories.put(ReplicaType.DISK_BACKED, new MockNetworkClientFactory(verifiableProperties, mockSelectorState, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, mockServerLayout, mockTime));
NetworkClientFactory networkClientFactory = new CompositeNetworkClientFactory(childFactories);
router = new NonBlockingRouter(routerConfig, routerMetrics, networkClientFactory, notificationSystem, mockClusterMap, kms, cryptoService, cryptoJobHandler, accountService, mockTime, MockClusterMap.DEFAULT_PARTITION_CLASS);
router.addResourceToClose(requestHandlerPool);
}
Aggregations