use of com.palantir.timelock.config.PaxosRuntimeConfiguration in project atlasdb by palantir.
the class PaxosResourcesFactory method configureLeaderForAllClients.
private static PaxosResources configureLeaderForAllClients(ImmutablePaxosResources.Builder resourcesBuilder, TimelockPaxosInstallationContext install, MetricsManager metrics, Supplier<PaxosRuntimeConfiguration> paxosRuntime, PaxosRemoteClients remoteClients) {
TimelockPaxosMetrics timelockMetrics = TimelockPaxosMetrics.of(PaxosUseCase.LEADER_FOR_ALL_CLIENTS, metrics);
Factories.LeaderPingHealthCheckFactory healthCheckPingersFactory = dependencies -> {
PingableLeader local = dependencies.components().pingableLeader(PaxosUseCase.PSEUDO_LEADERSHIP_CLIENT);
List<PingableLeader> remotes = dependencies.remoteClients().nonBatchPingableLeaders();
return LocalAndRemotes.of(new SingleLeaderHealthCheckPinger(local), remotes.stream().map(SingleLeaderHealthCheckPinger::new).collect(Collectors.toList()));
};
Factories.PaxosLatestRoundVerifierFactory latestRoundVerifierFactory = acceptorClient -> new CoalescingPaxosLatestRoundVerifier(new PaxosLatestRoundVerifierImpl(acceptorClient));
LeadershipContextFactory factory = ImmutableLeadershipContextFactory.builder().install(install).remoteClients(remoteClients).runtime(paxosRuntime).useCase(PaxosUseCase.LEADER_FOR_ALL_CLIENTS).metrics(timelockMetrics).networkClientFactoryBuilder(ImmutableSingleLeaderNetworkClientFactories.builder().useBatchedEndpoints(() -> paxosRuntime.get().enableBatchingForSingleLeader())).leaderPingerFactoryBuilder(ImmutableSingleLeaderPingerFactory.builder()).healthCheckPingersFactory(healthCheckPingersFactory).latestRoundVerifierFactory(latestRoundVerifierFactory).build();
return resourcesBuilder.leadershipContextFactory(factory).putLeadershipBatchComponents(PaxosUseCase.LEADER_FOR_ALL_CLIENTS, factory.components()).addAdhocResources(new BatchPingableLeaderResource(install.nodeUuid(), factory.components())).addAdhocResources(new LeaderAcceptorResource(factory.components().acceptor(PaxosUseCase.PSEUDO_LEADERSHIP_CLIENT)), new LeaderLearnerResource(factory.components().learner(PaxosUseCase.PSEUDO_LEADERSHIP_CLIENT)), factory.components().pingableLeader(PaxosUseCase.PSEUDO_LEADERSHIP_CLIENT)).timeLockCorruptionComponents(timeLockCorruptionComponents(install.sqliteDataSource(), remoteClients)).build();
}
Aggregations