Search in sources :

Example 1 with RestrictedTimeLockRuntimeConfiguration

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

the class TimeLockAgent method create.

// Legacy
@SuppressWarnings("TooManyArguments")
public static TimeLockAgent create(MetricsManager metricsManager, TimeLockInstallConfiguration install, Refreshable<TimeLockRuntimeConfiguration> runtime, ClusterConfiguration cluster, UserAgent userAgent, int threadPoolSize, long blockingTimeoutMs, Consumer<Object> registrar, Optional<Consumer<UndertowService>> undertowRegistrar, OrderableSlsVersion timeLockVersion, ObjectMapper objectMapper, Runnable serviceStopper) {
    verifyConfigurationSanity(install, cluster);
    // Restricting access to user-provided runtime config
    Refreshable<TimeLockRuntimeConfiguration> restrictedRuntime = runtime.map(RestrictedTimeLockRuntimeConfiguration::new);
    TimeLockDialogueServiceProvider timeLockDialogueServiceProvider = createTimeLockDialogueServiceProvider(metricsManager, cluster, userAgent);
    PaxosResourcesFactory.TimelockPaxosInstallationContext installationContext = ImmutableTimelockPaxosInstallationContext.of(install, cluster, userAgent, timeLockDialogueServiceProvider, timeLockVersion);
    // Upgrading the schema version should generally happen BEFORE any migration has started. Keep this in
    // mind for any potential live migrations
    PersistedSchemaVersion persistedSchemaVersion = PersistedSchemaVersion.create(installationContext.sqliteDataSource());
    persistedSchemaVersion.upgradeVersion(SCHEMA_VERSION);
    verifySchemaVersion(persistedSchemaVersion);
    verifyTimestampBoundPersisterConfiguration(installationContext.sqliteDataSource(), install.timestampBoundPersistence(), install.iAmOnThePersistenceTeamAndKnowWhatIAmDoingReseedPersistedPersisterConfiguration(), objectMapper);
    PaxosResources paxosResources = PaxosResourcesFactory.create(installationContext, metricsManager, Suppliers.compose(TimeLockRuntimeConfiguration::paxos, restrictedRuntime::get));
    AllNodesDisabledNamespacesUpdaterFactory updaterFactory = new AllNodesDisabledNamespacesUpdaterFactory(installationContext, metricsManager);
    TimeLockAgent agent = new TimeLockAgent(metricsManager, install, restrictedRuntime, cluster, undertowRegistrar, threadPoolSize, blockingTimeoutMs, registrar, paxosResources, updaterFactory, userAgent, persistedSchemaVersion, installationContext.sqliteDataSource(), serviceStopper);
    agent.createAndRegisterResources();
    return agent;
}
Also used : PaxosResourcesFactory(com.palantir.atlasdb.timelock.paxos.PaxosResourcesFactory) PaxosResources(com.palantir.atlasdb.timelock.paxos.PaxosResources) AllNodesDisabledNamespacesUpdaterFactory(com.palantir.atlasdb.timelock.management.AllNodesDisabledNamespacesUpdaterFactory) TimeLockRuntimeConfiguration(com.palantir.timelock.config.TimeLockRuntimeConfiguration) RestrictedTimeLockRuntimeConfiguration(com.palantir.timelock.config.RestrictedTimeLockRuntimeConfiguration) RestrictedTimeLockRuntimeConfiguration(com.palantir.timelock.config.RestrictedTimeLockRuntimeConfiguration)

Aggregations

AllNodesDisabledNamespacesUpdaterFactory (com.palantir.atlasdb.timelock.management.AllNodesDisabledNamespacesUpdaterFactory)1 PaxosResources (com.palantir.atlasdb.timelock.paxos.PaxosResources)1 PaxosResourcesFactory (com.palantir.atlasdb.timelock.paxos.PaxosResourcesFactory)1 RestrictedTimeLockRuntimeConfiguration (com.palantir.timelock.config.RestrictedTimeLockRuntimeConfiguration)1 TimeLockRuntimeConfiguration (com.palantir.timelock.config.TimeLockRuntimeConfiguration)1