Search in sources :

Example 1 with ImmutableDefaultClusterConfiguration

use of com.palantir.timelock.config.ImmutableDefaultClusterConfiguration in project atlasdb by palantir.

the class InMemoryTimelockServices method before.

@Override
protected void before() throws IOException {
    PaxosInstallConfiguration paxos = PaxosInstallConfiguration.builder().dataDirectory(tryCreateSubFolder(tempFolder)).leaderMode(PaxosLeaderMode.SINGLE_LEADER).sqlitePersistence(ImmutableSqlitePaxosPersistenceConfiguration.builder().dataDirectory(tryCreateSubFolder(tempFolder, client)).build()).isNewService(false).build();
    ClusterInstallConfiguration cluster = ImmutableClusterInstallConfiguration.builder().enableNonstandardAndPossiblyDangerousTopology(true).build();
    TimeLockInstallConfiguration install = TimeLockInstallConfiguration.builder().paxos(paxos).cluster(cluster).build();
    ImmutableDefaultClusterConfiguration clusterConfig = ImmutableDefaultClusterConfiguration.builder().localServer("local").cluster(PartialServiceConfiguration.of(List.of("local"), Optional.empty())).build();
    TimeLockRuntimeConfiguration runtime = ImmutableTimeLockRuntimeConfiguration.builder().permittedBackupToken(BEARER_TOKEN).clusterSnapshot(clusterConfig).build();
    MetricsManager metricsManager = MetricsManagers.createForTests();
    timeLockAgent = TimeLockAgent.create(metricsManager, install, // This won't actually live reload.
    Refreshable.only(runtime), runtime.clusterSnapshot(), USER_AGENT, THREAD_POOL_SIZE, BLOCKING_TIMEOUT_MS, _unused -> {
    }, Optional.empty(), OrderableSlsVersion.valueOf("0.0.0"), ObjectMappers.newServerObjectMapper(), () -> System.exit(0));
    delegate = timeLockAgent.createInvalidatingTimeLockServices(client);
    createHelperServices(metricsManager);
    // Wait for leadership
    Awaitility.await().atMost(Duration.ofSeconds(30L)).pollInterval(Duration.ofMillis(50)).ignoreExceptions().until(() -> delegate.getTimestampService().getFreshTimestamp() > 0);
}
Also used : CommitTimestampGetter(com.palantir.lock.client.CommitTimestampGetter) ObjectMappers(com.palantir.conjure.java.serialization.ObjectMappers) TimeLockInstallConfiguration(com.palantir.timelock.config.TimeLockInstallConfiguration) ImmutableSqlitePaxosPersistenceConfiguration(com.palantir.timelock.config.ImmutableSqlitePaxosPersistenceConfiguration) TimeLockRuntimeConfiguration(com.palantir.timelock.config.TimeLockRuntimeConfiguration) RedirectRetryTargeter(com.palantir.atlasdb.http.RedirectRetryTargeter) NamespacedConjureTimelockServiceImpl(com.palantir.lock.client.NamespacedConjureTimelockServiceImpl) MetricsManager(com.palantir.atlasdb.util.MetricsManager) NamespacedTimelockRpcClient(com.palantir.lock.v2.NamespacedTimelockRpcClient) UserAgent(com.palantir.conjure.java.api.config.service.UserAgent) Duration(java.time.Duration) After(org.junit.After) ImmutableClusterInstallConfiguration(com.palantir.timelock.config.ImmutableClusterInstallConfiguration) AsyncTimelockService(com.palantir.atlasdb.timelock.AsyncTimelockService) TimestampService(com.palantir.timestamp.TimestampService) Refreshable(com.palantir.refreshable.Refreshable) ImmutableSet(com.google.common.collect.ImmutableSet) TimestampManagementService(com.palantir.timestamp.TimestampManagementService) ConjureTimelockResource(com.palantir.atlasdb.timelock.ConjureTimelockResource) OrderableSlsVersion(com.palantir.sls.versions.OrderableSlsVersion) TimeLockServices(com.palantir.atlasdb.timelock.TimeLockServices) TimeLockHelperServices(com.palantir.atlasdb.factory.TimeLockHelperServices) MetricsManagers(com.palantir.atlasdb.util.MetricsManagers) List(java.util.List) ExternalResource(org.junit.rules.ExternalResource) LockWatchCachingConfig(com.palantir.atlasdb.keyvalue.api.LockWatchCachingConfig) ClusterInstallConfiguration(com.palantir.timelock.config.ClusterInstallConfiguration) TransactionStarter(com.palantir.lock.client.TransactionStarter) PartialServiceConfiguration(com.palantir.conjure.java.api.config.service.PartialServiceConfiguration) Optional(java.util.Optional) Awaitility(org.awaitility.Awaitility) PaxosLeaderMode(com.palantir.timelock.config.PaxosInstallConfiguration.PaxosLeaderMode) ConjureTimelockService(com.palantir.atlasdb.timelock.api.ConjureTimelockService) RequestBatchersFactory(com.palantir.lock.client.RequestBatchersFactory) AsyncTimelockResource(com.palantir.atlasdb.timelock.AsyncTimelockResource) ImmutableTimeLockRuntimeConfiguration(com.palantir.timelock.config.ImmutableTimeLockRuntimeConfiguration) RemoteTimelockServiceAdapter(com.palantir.lock.client.RemoteTimelockServiceAdapter) BearerToken(com.palantir.tokens.auth.BearerToken) SafeRuntimeException(com.palantir.logsafe.exceptions.SafeRuntimeException) IOException(java.io.IOException) LockWatchManagerInternal(com.palantir.atlasdb.keyvalue.api.watch.LockWatchManagerInternal) TimelockService(com.palantir.lock.v2.TimelockService) File(java.io.File) LockService(com.palantir.lock.LockService) ImmutableDefaultClusterConfiguration(com.palantir.timelock.config.ImmutableDefaultClusterConfiguration) ManagedTimestampService(com.palantir.timestamp.ManagedTimestampService) LockLeaseService(com.palantir.lock.client.LockLeaseService) Closeable(java.io.Closeable) PaxosInstallConfiguration(com.palantir.timelock.config.PaxosInstallConfiguration) LegacyLeaderTimeGetter(com.palantir.lock.client.LegacyLeaderTimeGetter) TemporaryFolder(org.junit.rules.TemporaryFolder) TimeLockInstallConfiguration(com.palantir.timelock.config.TimeLockInstallConfiguration) ImmutableDefaultClusterConfiguration(com.palantir.timelock.config.ImmutableDefaultClusterConfiguration) MetricsManager(com.palantir.atlasdb.util.MetricsManager) ImmutableClusterInstallConfiguration(com.palantir.timelock.config.ImmutableClusterInstallConfiguration) ClusterInstallConfiguration(com.palantir.timelock.config.ClusterInstallConfiguration) TimeLockRuntimeConfiguration(com.palantir.timelock.config.TimeLockRuntimeConfiguration) ImmutableTimeLockRuntimeConfiguration(com.palantir.timelock.config.ImmutableTimeLockRuntimeConfiguration) PaxosInstallConfiguration(com.palantir.timelock.config.PaxosInstallConfiguration)

Aggregations

ImmutableSet (com.google.common.collect.ImmutableSet)1 TimeLockHelperServices (com.palantir.atlasdb.factory.TimeLockHelperServices)1 RedirectRetryTargeter (com.palantir.atlasdb.http.RedirectRetryTargeter)1 LockWatchCachingConfig (com.palantir.atlasdb.keyvalue.api.LockWatchCachingConfig)1 LockWatchManagerInternal (com.palantir.atlasdb.keyvalue.api.watch.LockWatchManagerInternal)1 AsyncTimelockResource (com.palantir.atlasdb.timelock.AsyncTimelockResource)1 AsyncTimelockService (com.palantir.atlasdb.timelock.AsyncTimelockService)1 ConjureTimelockResource (com.palantir.atlasdb.timelock.ConjureTimelockResource)1 TimeLockServices (com.palantir.atlasdb.timelock.TimeLockServices)1 ConjureTimelockService (com.palantir.atlasdb.timelock.api.ConjureTimelockService)1 MetricsManager (com.palantir.atlasdb.util.MetricsManager)1 MetricsManagers (com.palantir.atlasdb.util.MetricsManagers)1 PartialServiceConfiguration (com.palantir.conjure.java.api.config.service.PartialServiceConfiguration)1 UserAgent (com.palantir.conjure.java.api.config.service.UserAgent)1 ObjectMappers (com.palantir.conjure.java.serialization.ObjectMappers)1 LockService (com.palantir.lock.LockService)1 CommitTimestampGetter (com.palantir.lock.client.CommitTimestampGetter)1 LegacyLeaderTimeGetter (com.palantir.lock.client.LegacyLeaderTimeGetter)1 LockLeaseService (com.palantir.lock.client.LockLeaseService)1 NamespacedConjureTimelockServiceImpl (com.palantir.lock.client.NamespacedConjureTimelockServiceImpl)1