Search in sources :

Example 1 with PaxosRuntimeConfiguration

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();
}
Also used : PersistentTimestampServiceImpl(com.palantir.timestamp.PersistentTimestampServiceImpl) PaxosLeaderMode(com.palantir.timelock.config.PaxosInstallConfiguration.PaxosLeaderMode) TimeLockInstallConfiguration(com.palantir.timelock.config.TimeLockInstallConfiguration) PaxosLearnerNetworkClient(com.palantir.paxos.PaxosLearnerNetworkClient) Supplier(java.util.function.Supplier) TrustContext(com.palantir.conjure.java.config.ssl.TrustContext) TimestampBoundStore(com.palantir.timestamp.TimestampBoundStore) LocalHistoryLoader(com.palantir.timelock.history.LocalHistoryLoader) MetricsManager(com.palantir.atlasdb.util.MetricsManager) UserAgent(com.palantir.conjure.java.api.config.service.UserAgent) SqlitePaxosStateLogHistory(com.palantir.timelock.history.sqlite.SqlitePaxosStateLogHistory) Value(org.immutables.value.Value) ClusterConfiguration(com.palantir.timelock.config.ClusterConfiguration) DataSource(javax.sql.DataSource) Suppliers(com.google.common.base.Suppliers) RemoteCorruptionDetector(com.palantir.timelock.corruption.detection.RemoteCorruptionDetector) PredicateSwitchedProxy(com.palantir.common.proxy.PredicateSwitchedProxy) SqliteConnections(com.palantir.paxos.SqliteConnections) Path(java.nio.file.Path) PaxosProposerImpl(com.palantir.paxos.PaxosProposerImpl) PaxosLogHistoryProvider(com.palantir.timelock.history.PaxosLogHistoryProvider) OrderableSlsVersion(com.palantir.sls.versions.OrderableSlsVersion) CoalescingPaxosLatestRoundVerifier(com.palantir.paxos.CoalescingPaxosLatestRoundVerifier) PaxosLatestRoundVerifierImpl(com.palantir.paxos.PaxosLatestRoundVerifierImpl) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) PaxosRemotingUtils(com.palantir.timelock.paxos.PaxosRemotingUtils) SslSocketFactories(com.palantir.conjure.java.config.ssl.SslSocketFactories) TimeLockDialogueServiceProvider(com.palantir.timelock.paxos.TimeLockDialogueServiceProvider) PaxosRuntimeConfiguration(com.palantir.timelock.config.PaxosRuntimeConfiguration) LocalTimestampInvariantsVerifier(com.palantir.timelock.corruption.detection.LocalTimestampInvariantsVerifier) PaxosProposer(com.palantir.paxos.PaxosProposer) List(java.util.List) PaxosAcceptorNetworkClient(com.palantir.paxos.PaxosAcceptorNetworkClient) CorruptionHealthCheck(com.palantir.timelock.corruption.detection.CorruptionHealthCheck) LocalCorruptionDetector(com.palantir.timelock.corruption.detection.LocalCorruptionDetector) ManagedTimestampService(com.palantir.timestamp.ManagedTimestampService) HikariDataSource(com.zaxxer.hikari.HikariDataSource) Optional(java.util.Optional) VisibleForTesting(com.google.common.annotations.VisibleForTesting) PingableLeader(com.palantir.leader.PingableLeader) CoalescingPaxosLatestRoundVerifier(com.palantir.paxos.CoalescingPaxosLatestRoundVerifier) PaxosLatestRoundVerifierImpl(com.palantir.paxos.PaxosLatestRoundVerifierImpl) PingableLeader(com.palantir.leader.PingableLeader) List(java.util.List) SslSocketFactories(com.palantir.conjure.java.config.ssl.SslSocketFactories)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Suppliers (com.google.common.base.Suppliers)1 MetricsManager (com.palantir.atlasdb.util.MetricsManager)1 PredicateSwitchedProxy (com.palantir.common.proxy.PredicateSwitchedProxy)1 UserAgent (com.palantir.conjure.java.api.config.service.UserAgent)1 SslSocketFactories (com.palantir.conjure.java.config.ssl.SslSocketFactories)1 TrustContext (com.palantir.conjure.java.config.ssl.TrustContext)1 PingableLeader (com.palantir.leader.PingableLeader)1 CoalescingPaxosLatestRoundVerifier (com.palantir.paxos.CoalescingPaxosLatestRoundVerifier)1 PaxosAcceptorNetworkClient (com.palantir.paxos.PaxosAcceptorNetworkClient)1 PaxosLatestRoundVerifierImpl (com.palantir.paxos.PaxosLatestRoundVerifierImpl)1 PaxosLearnerNetworkClient (com.palantir.paxos.PaxosLearnerNetworkClient)1 PaxosProposer (com.palantir.paxos.PaxosProposer)1 PaxosProposerImpl (com.palantir.paxos.PaxosProposerImpl)1 SqliteConnections (com.palantir.paxos.SqliteConnections)1 OrderableSlsVersion (com.palantir.sls.versions.OrderableSlsVersion)1 ClusterConfiguration (com.palantir.timelock.config.ClusterConfiguration)1 PaxosLeaderMode (com.palantir.timelock.config.PaxosInstallConfiguration.PaxosLeaderMode)1 PaxosRuntimeConfiguration (com.palantir.timelock.config.PaxosRuntimeConfiguration)1 TimeLockInstallConfiguration (com.palantir.timelock.config.TimeLockInstallConfiguration)1