@Test public void testSetMapping() { Long value; try (FDBRecordContext context = database.openContext()) { value = globalScope.resolve(context.getTimer(), "an-existing-mapping").join(); } try (FDBRecordContext context = database.openContext()) { globalScope.setMapping(context, "a-new-mapping", 99L).join(); globalScope.setMapping(context, "an-existing-mapping", value).join(); context.commit(); } try (FDBRecordContext context = database.openContext()) { assertThat("we can see the new mapping", globalScope.resolve(context.getTimer(), "a-new-mapping").join(), is(99L)); assertThat("we can see the new reverse mapping", globalScope.reverseLookup(null, 99L).join(), is("a-new-mapping")); assertThat("we can see the existing mapping", globalScope.resolve(context.getTimer(), "an-existing-mapping").join(), is(value)); assertThat("we can see the existing reverse mapping", globalScope.reverseLookup(null, value).join(), is("an-existing-mapping")); } }
protected abstract CompletableFuture<Void> setMapping(FDBRecordContext context, String key, ResolverResult value);
LocatableResolver { protected abstract CompletableFuture<Void> setMapping(FDBRecordContext context, String key, ResolverResult value); }
LocatableResolver { protected abstract CompletableFuture<Void> setMapping(FDBRecordContext context, String key, ResolverResult value); protected  LocatableResolver(@Nonnull FDBDatabase database,
                                @Nullable KeySpacePath path,
                                @Nullable CompletableFuture<ResolvedKeySpacePath> resolvedPath); }
LocatableResolver { protected abstract CompletableFuture<Void> setMapping(FDBRecordContext context, String key, ResolverResult value); protected  LocatableResolver(@Nonnull FDBDatabase database,
                                @Nullable KeySpacePath path,
                                @Nullable CompletableFuture<ResolvedKeySpacePath> resolvedPath); ScopedValue<T> wrap(T value); @Nonnull FDBDatabase getDatabase(); @Nonnull CompletableFuture<Long> resolve(@Nonnull String name); @Nonnull CompletableFuture<Long> resolve(@Nullable FDBStoreTimer timer, @Nonnull String name); @API(API.Status.UNSTABLE) @Nonnull CompletableFuture<Long> resolve(@Nonnull FDBRecordContext context, @Nonnull String name); @Nonnull CompletableFuture<Long> resolve(@Nonnull String name,
                                           @Nonnull ResolverCreateHooks hooks); @Nonnull CompletableFuture<Long> resolve(@Nullable FDBStoreTimer timer,
                                           @Nonnull String name,
                                           @Nonnull ResolverCreateHooks hooks); @API(API.Status.UNSTABLE) @Nonnull CompletableFuture<Long> resolve(@Nonnull FDBRecordContext context,
                                           @Nonnull String name,
                                           @Nonnull ResolverCreateHooks hooks); @Nonnull CompletableFuture<ResolverResult> resolveWithMetadata(@Nonnull String name,
                                                                 @Nonnull ResolverCreateHooks hooks); @Nonnull CompletableFuture<ResolverResult> resolveWithMetadata(@Nullable FDBStoreTimer timer,
                                                                 @Nonnull String name,
                                                                 @Nonnull ResolverCreateHooks hooks); @API(API.Status.UNSTABLE) @Nonnull CompletableFuture<ResolverResult> resolveWithMetadata(@Nonnull FDBRecordContext context, @Nonnull String name, @Nonnull ResolverCreateHooks hooks); @Nonnull CompletableFuture<ResolverResult> mustResolveWithMetadata(@Nonnull FDBRecordContext context, @Nonnull String name); CompletableFuture<Long> mustResolve(@Nonnull FDBRecordContext context, @Nonnull String name); @Nonnull CompletableFuture<String> reverseLookup(@Nullable FDBStoreTimer timer, @Nonnull Long value); @Nonnull CompletableFuture<Void> exclusiveLock(); @Nonnull CompletableFuture<Void> enableWriteLock(); @Nonnull CompletableFuture<Void> disableWriteLock(); @Nonnull CompletableFuture<Void> retireLayer(); @Nonnull CompletableFuture<Void> incrementVersion(); @Nonnull CompletableFuture<Integer> getVersion(@Nullable FDBStoreTimer timer); @Nonnull CompletableFuture<Boolean> retired(@Nullable FDBStoreTimer timer); @Nonnull CompletableFuture<Boolean> retiredSkipCache(@Nonnull FDBRecordContext context); @Nonnull CompletableFuture<Void> updateMetadataAndVersion(@Nonnull final String key,
                                                            @Nullable final byte[] metadata); @VisibleForTesting final CompletableFuture<Void> setMapping(FDBRecordContext context, String key, Long value); @VisibleForTesting abstract CompletableFuture<Void> setWindow(long count); @Nonnull @API(API.Status.DEPRECATED) @Deprecated Subspace getMappingSubspace(); @Nonnull abstract CompletableFuture<Subspace> getMappingSubspaceAsync(); @Nonnull @API(API.Status.DEPRECATED) @Deprecated Subspace getBaseSubspace(); @Nonnull abstract CompletableFuture<Subspace> getBaseSubspaceAsync(); @Nonnull abstract ResolverResult deserializeValue(byte[] value); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); }
LocatableResolver { protected abstract CompletableFuture<Void> setMapping(FDBRecordContext context, String key, ResolverResult value); protected  LocatableResolver(@Nonnull FDBDatabase database,
                                @Nullable KeySpacePath path,
                                @Nullable CompletableFuture<ResolvedKeySpacePath> resolvedPath); ScopedValue<T> wrap(T value); @Nonnull FDBDatabase getDatabase(); @Nonnull CompletableFuture<Long> resolve(@Nonnull String name); @Nonnull CompletableFuture<Long> resolve(@Nullable FDBStoreTimer timer, @Nonnull String name); @API(API.Status.UNSTABLE) @Nonnull CompletableFuture<Long> resolve(@Nonnull FDBRecordContext context, @Nonnull String name); @Nonnull CompletableFuture<Long> resolve(@Nonnull String name,
                                           @Nonnull ResolverCreateHooks hooks); @Nonnull CompletableFuture<Long> resolve(@Nullable FDBStoreTimer timer,
                                           @Nonnull String name,
                                           @Nonnull ResolverCreateHooks hooks); @API(API.Status.UNSTABLE) @Nonnull CompletableFuture<Long> resolve(@Nonnull FDBRecordContext context,
                                           @Nonnull String name,
                                           @Nonnull ResolverCreateHooks hooks); @Nonnull CompletableFuture<ResolverResult> resolveWithMetadata(@Nonnull String name,
                                                                 @Nonnull ResolverCreateHooks hooks); @Nonnull CompletableFuture<ResolverResult> resolveWithMetadata(@Nullable FDBStoreTimer timer,
                                                                 @Nonnull String name,
                                                                 @Nonnull ResolverCreateHooks hooks); @API(API.Status.UNSTABLE) @Nonnull CompletableFuture<ResolverResult> resolveWithMetadata(@Nonnull FDBRecordContext context, @Nonnull String name, @Nonnull ResolverCreateHooks hooks); @Nonnull CompletableFuture<ResolverResult> mustResolveWithMetadata(@Nonnull FDBRecordContext context, @Nonnull String name); CompletableFuture<Long> mustResolve(@Nonnull FDBRecordContext context, @Nonnull String name); @Nonnull CompletableFuture<String> reverseLookup(@Nullable FDBStoreTimer timer, @Nonnull Long value); @Nonnull CompletableFuture<Void> exclusiveLock(); @Nonnull CompletableFuture<Void> enableWriteLock(); @Nonnull CompletableFuture<Void> disableWriteLock(); @Nonnull CompletableFuture<Void> retireLayer(); @Nonnull CompletableFuture<Void> incrementVersion(); @Nonnull CompletableFuture<Integer> getVersion(@Nullable FDBStoreTimer timer); @Nonnull CompletableFuture<Boolean> retired(@Nullable FDBStoreTimer timer); @Nonnull CompletableFuture<Boolean> retiredSkipCache(@Nonnull FDBRecordContext context); @Nonnull CompletableFuture<Void> updateMetadataAndVersion(@Nonnull final String key,
                                                            @Nullable final byte[] metadata); @VisibleForTesting final CompletableFuture<Void> setMapping(FDBRecordContext context, String key, Long value); @VisibleForTesting abstract CompletableFuture<Void> setWindow(long count); @Nonnull @API(API.Status.DEPRECATED) @Deprecated Subspace getMappingSubspace(); @Nonnull abstract CompletableFuture<Subspace> getMappingSubspaceAsync(); @Nonnull @API(API.Status.DEPRECATED) @Deprecated Subspace getBaseSubspace(); @Nonnull abstract CompletableFuture<Subspace> getBaseSubspaceAsync(); @Nonnull abstract ResolverResult deserializeValue(byte[] value); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }