use of com.palantir.timelock.config.TimeLockInstallConfiguration in project atlasdb by palantir.
the class TimeLockConfigMigrator method convert.
public static CombinedTimeLockServerConfiguration convert(TimeLockServerConfiguration config, Environment environment) {
// taking advantage of the fact that there is only one algorithm impl at the moment
Preconditions.checkArgument(PaxosConfiguration.class.isInstance(config.algorithm()), "Paxos is the only leader election algorithm currently supported. Not: %s", config.algorithm().getClass());
PaxosConfiguration paxos = (PaxosConfiguration) config.algorithm();
TimeLockInstallConfiguration install = ImmutableTimeLockInstallConfiguration.builder().timestampBoundPersistence(config.getTsBoundPersisterConfiguration()).paxos(ImmutablePaxosInstallConfiguration.builder().dataDirectory(paxos.paxosDataDir()).build()).cluster(ImmutableDefaultClusterConfiguration.builder().cluster(PartialServiceConfiguration.builder().security(paxos.sslConfiguration()).uris(config.cluster().servers()).build()).localServer(config.cluster().localServer()).build()).asyncLock(config.asyncLockConfiguration()).build();
TimeLockRuntimeConfiguration runtime = ImmutableTimeLockRuntimeConfiguration.builder().paxos(ImmutablePaxosRuntimeConfiguration.builder().leaderPingResponseWaitMs(paxos.leaderPingResponseWaitMs()).maximumWaitBeforeProposalMs(paxos.maximumWaitBeforeProposalMs()).pingRateMs(paxos.pingRateMs()).build()).slowLockLogTriggerMillis(config.slowLockLogTriggerMillis()).build();
TimeLockDeprecatedConfiguration deprecated = createDeprecatedConfiguration(config, environment);
return ImmutableCombinedTimeLockServerConfiguration.builder().install(install).runtime(runtime).deprecated(deprecated).build();
}
Aggregations