private static LockAndTimestampServices createRawInstrumentedServices( MetricsManager metricsManager, AtlasDbConfig config, Supplier<AtlasDbRuntimeConfig> runtimeConfigSupplier, Consumer<Object> env, com.google.common.base.Supplier<LockService> lock, com.google.common.base.Supplier<TimestampService> time, com.google.common.base.Supplier<TimestampManagementService> timeManagement, TimestampStoreInvalidator invalidator, String userAgent) { AtlasDbRuntimeConfig initialRuntimeConfig = runtimeConfigSupplier.get(); assertNoSpuriousTimeLockBlockInRuntimeConfig(config, initialRuntimeConfig); if (config.leader().isPresent()) { return createRawLeaderServices( metricsManager, config.leader().get(), env, lock, time, timeManagement, userAgent); } else if (config.timestamp().isPresent() && config.lock().isPresent()) { return createRawRemoteServices(metricsManager, config, userAgent); } else if (isUsingTimeLock(config, initialRuntimeConfig)) { return createRawServicesFromTimeLock(metricsManager, config, runtimeConfigSupplier, invalidator, userAgent); } else { return createRawEmbeddedServices(metricsManager, env, lock, time, timeManagement); } }
private static Callback<TransactionManager> timelockConsistencyCheckCallback( AtlasDbConfig atlasDbConfig, AtlasDbRuntimeConfig initialRuntimeConfig, LockAndTimestampServices lockAndTimestampServices) { if (isUsingTimeLock(atlasDbConfig, initialRuntimeConfig)) { // Only do the consistency check if we're using TimeLock. // This avoids a bootstrapping problem with leader-block services without async initialisation, // where you need a working timestamp service to check consistency, you need to check consistency // before you can return a TM, you need to return a TM to listen on ports, and you need to listen on // ports in order to get a working timestamp service. return ConsistencyCheckRunner.create( ImmutableTimestampCorroborationConsistencyCheck.builder() .conservativeBound(TransactionManager::getUnreadableTimestamp) .freshTimestampSource(unused -> lockAndTimestampServices.timelock().getFreshTimestamp()) .build()); } return Callback.noOp(); }
private static LockAndTimestampServices createRawInstrumentedServices( MetricsManager metricsManager, AtlasDbConfig config, Supplier<AtlasDbRuntimeConfig> runtimeConfigSupplier, Consumer<Object> env, com.google.common.base.Supplier<LockService> lock, com.google.common.base.Supplier<TimestampService> time, com.google.common.base.Supplier<TimestampManagementService> timeManagement, TimestampStoreInvalidator invalidator, String userAgent) { AtlasDbRuntimeConfig initialRuntimeConfig = runtimeConfigSupplier.get(); assertNoSpuriousTimeLockBlockInRuntimeConfig(config, initialRuntimeConfig); if (config.leader().isPresent()) { return createRawLeaderServices( metricsManager, config.leader().get(), env, lock, time, timeManagement, userAgent); } else if (config.timestamp().isPresent() && config.lock().isPresent()) { return createRawRemoteServices(metricsManager, config, userAgent); } else if (isUsingTimeLock(config, initialRuntimeConfig)) { return createRawServicesFromTimeLock(metricsManager, config, runtimeConfigSupplier, invalidator, userAgent); } else { return createRawEmbeddedServices(metricsManager, env, lock, time, timeManagement); } }
private static Callback<TransactionManager> timelockConsistencyCheckCallback( AtlasDbConfig atlasDbConfig, AtlasDbRuntimeConfig initialRuntimeConfig, LockAndTimestampServices lockAndTimestampServices) { if (isUsingTimeLock(atlasDbConfig, initialRuntimeConfig)) { // Only do the consistency check if we're using TimeLock. // This avoids a bootstrapping problem with leader-block services without async initialisation, // where you need a working timestamp service to check consistency, you need to check consistency // before you can return a TM, you need to return a TM to listen on ports, and you need to listen on // ports in order to get a working timestamp service. return ConsistencyCheckRunner.create( ImmutableTimestampCorroborationConsistencyCheck.builder() .conservativeBound(TransactionManager::getUnreadableTimestamp) .freshTimestampSource(unused -> lockAndTimestampServices.timelock().getFreshTimestamp()) .build()); } return Callback.noOp(); }