Codota Logo
com.palantir.atlasdb.internalschema
Code IndexAdd Codota to your IDE (free)

How to use com.palantir.atlasdb.internalschema

Best Java code snippets using com.palantir.atlasdb.internalschema (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: palantir/atlasdb

  static InternalSchemaMetadata defaultValue() {
    return builder().build();
  }
}
origin: palantir/atlasdb

private TimestampPartitioningMap<Integer> installNewVersionInMap(
    TimestampPartitioningMap<Integer> sourceMap, long bound, int newVersion) {
  return sourceMap.copyInstallingNewValue(bound, newVersion);
}
origin: palantir/atlasdb

static ImmutableInternalSchemaMetadata.Builder builder() {
  return ImmutableInternalSchemaMetadata.builder();
}
origin: palantir/atlasdb

public TimestampPartitioningMap<T> copyInstallingNewValue(
    long lowerBoundForNewVersion,
    T newValue) {
  RangeAndValue<T> latestEntry = getLatestEntry();
  validateProvidedTimestampBounds(lowerBoundForNewVersion, newValue, latestEntry);
  ImmutableRangeMap.Builder<Long, T> builder = ImmutableRangeMap.builder();
  copyOldRangesFromPreviousMap(latestEntry, builder);
  addNewRanges(lowerBoundForNewVersion, newValue, latestEntry, builder);
  return ImmutableTimestampPartitioningMap.of(builder.build());
}
origin: palantir/atlasdb

private void copyOldRangesFromPreviousMap(
    RangeAndValue latestRangeAndValue,
    @Output ImmutableRangeMap.Builder<Long, T> builder) {
  timestampMappings()
      .stream()
      .filter(rangeAndValue -> !rangeAndValue.equals(latestRangeAndValue))
      .forEach(rangeAndValue -> builder.put(rangeAndValue.longRange(), rangeAndValue.value()));
}
origin: palantir/atlasdb

@Test
public void canSwitchBetweenSchemaVersions() {
  assertThat(manager.tryInstallNewTransactionsSchemaVersion(2)).isTrue();
  fastForwardTimestampByOneHundredMillion();
  assertThat(manager.getTransactionsSchemaVersion(timestamps.getFreshTimestamp())).isEqualTo(2);
  assertThat(manager.tryInstallNewTransactionsSchemaVersion(1)).isTrue();
  fastForwardTimestampByOneHundredMillion();
  assertThat(manager.getTransactionsSchemaVersion(timestamps.getFreshTimestamp())).isEqualTo(1);
}
origin: palantir/atlasdb

@Value.Check
public void check() {
  validateCoversPreciselyAllTimestamps(rangeMapView());
}
origin: palantir/atlasdb

private RangeAndValue<T> getLatestEntry() {
  return RangeAndValue.fromMapEntry(rangeMapView()
      .asDescendingMapOfRanges()
      .entrySet()
      .iterator()
      .next());
}
origin: palantir/atlasdb

public static <T> TimestampPartitioningMap<T> of(RangeMap<Long, T> initialState) {
  return ImmutableTimestampPartitioningMap.of(
      initialState.asMapOfRanges()
          .entrySet()
          .stream()
          .map(entry -> RangeAndValue.of(entry.getKey(), entry.getValue()))
          .collect(Collectors.toSet()));
}
origin: palantir/atlasdb

@Override
public void forceInstallNewTransactionsSchemaVersion(int newVersion) {
  while (transactionSchemaManager.getTransactionsSchemaVersion(
      timestampService.getFreshTimestamp()) != newVersion) {
    transactionSchemaManager.tryInstallNewTransactionsSchemaVersion(newVersion);
    advanceOneHundredMillionTimestamps();
  }
}
origin: palantir/atlasdb

  private static Optional<Integer> extractTimestampVersion(
      Optional<ValueAndBound<InternalSchemaMetadata>> valueAndBound, long timestamp) {
    return valueAndBound
        .flatMap(ValueAndBound::value)
        .map(InternalSchemaMetadata::timestampToTransactionsTableSchemaVersion)
        .map(versionMap -> versionMap.getValueForTimestamp(timestamp));
  }
}
origin: palantir/atlasdb

@Test
public void canFailToInstallNewVersions() {
  TransactionSchemaManager newManager = createTransactionSchemaManager(new InMemoryTimestampService());
  // Always need to seed the default value, if it's not there
  assertThat(newManager.tryInstallNewTransactionsSchemaVersion(5)).isFalse();
  assertThat(newManager.tryInstallNewTransactionsSchemaVersion(5)).isTrue();
}
origin: palantir/atlasdb

@Override
public boolean tryInstallNewTransactionsSchemaVersion(int newVersion) {
  return transactionSchemaManager.tryInstallNewTransactionsSchemaVersion(newVersion);
}
origin: palantir/atlasdb

@Override
public int getTransactionsSchemaVersion(long timestamp) {
  return transactionSchemaManager.getTransactionsSchemaVersion(timestamp);
}
origin: palantir/atlasdb

static <T> RangeAndValue<T> of(Range<Long> longRange, T value) {
  return ImmutableRangeAndValue.of(longRange, value);
}
origin: palantir/atlasdb

  static <T> RangeAndValue<T> fromMapEntry(Map.Entry<Range<Long>, T> entry) {
    return of(entry.getKey(), entry.getValue());
  }
}
origin: palantir/atlasdb

public T getValueForTimestamp(long timestamp) {
  return rangeMapView().get(timestamp);
}
origin: palantir/atlasdb

@Value.Lazy
RangeMap<Long, T> rangeMapView() {
  ImmutableRangeMap.Builder<Long, T> builder = new ImmutableRangeMap.Builder<>();
  timestampMappings()
      .forEach(rangeAndValue -> builder.put(rangeAndValue.longRange(), rangeAndValue.value()));
  return builder.build();
}
origin: palantir/atlasdb

@Test
public void newSchemaVersionsCanBeInstalledWithinOneHundredMillionTimestamps() {
  assertThat(manager.tryInstallNewTransactionsSchemaVersion(2)).isTrue();
  fastForwardTimestampByOneHundredMillion();
  assertThat(manager.getTransactionsSchemaVersion(timestamps.getFreshTimestamp())).isEqualTo(2);
}
origin: palantir/atlasdb

  private static Optional<Integer> extractTimestampVersion(
      Optional<ValueAndBound<InternalSchemaMetadata>> valueAndBound, long timestamp) {
    return valueAndBound
        .flatMap(ValueAndBound::value)
        .map(InternalSchemaMetadata::timestampToTransactionsTableSchemaVersion)
        .map(versionMap -> versionMap.getValueForTimestamp(timestamp));
  }
}
com.palantir.atlasdb.internalschema

Most used classes

  • CoordinationServices
  • MetadataCoordinationServiceMetrics
  • TransactionSchemaManager
  • TimestampPartitioningMap
    A TimestampPartitioningMap keeps track of a mapping of timestamp ranges to values. TimestampPartitio
  • ImmutableVersionedInternalSchemaMetadata$Builder
  • VersionedInternalSchemaMetadata,
  • ImmutableInternalSchemaMetadata$Builder,
  • ImmutableInternalSchemaMetadata,
  • ImmutableRangeAndValue,
  • ImmutableTimestampPartitioningMap,
  • InternalSchemaMetadata,
  • ReadOnlyTransactionSchemaManager,
  • TimestampPartitioningMap$RangeAndValue,
  • TransactionSchemaManagerIntegrationTest,
  • MetadataCoordinationServiceMetricsTest,
  • InternalSchemaMetadataPayloadCodec,
  • InternalSchemaMetadataPayloadCodecTest
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now