StringInterningLayer { protected CompletableFuture<Boolean> exists(@Nonnull FDBRecordContext context, @Nonnull final String toRead) { return context.ensureActive().get(mappingSubspace.pack(toRead)) .thenApply(Objects::nonNull); } StringInterningLayer(@Nonnull Subspace baseSubspace);  StringInterningLayer(@Nonnull Subspace baseSubspace, boolean isRootLevel); private  StringInterningLayer(@Nonnull Subspace mappingSubspace,
                                 @Nonnull Subspace reverseMappingSubspace,
                                 @Nonnull Subspace counterSubspace,
                                 boolean isRootLevel);   }
@Test void testExists() { try (FDBRecordContext context = database.openContext()) { StringInterningLayer interningLayer = new StringInterningLayer(testSubspace); interningLayer.intern(context, "string-1").join(); context.commit(); } try (FDBRecordContext context = database.openContext()) { StringInterningLayer interningLayer = new StringInterningLayer(testSubspace); interningLayer.intern(context, "string-2").join(); assertTrue(interningLayer.exists(context, "string-1").join(), "we see previously committed values"); assertTrue(interningLayer.exists(context, "string-2").join(), "we see values added in the current transaction"); assertFalse(interningLayer.exists(context, "string-3").join(), "we don't see values that haven't been added"); } }