@@ -0,0 +1,2518 @@
+// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.%0Apackage com.intellij.util.io;%0A%0Aimport com.intellij.util.Processor;%0Aimport org.jetbrains.annotations.NotNull;%0A%0Aimport java.io.IOException;%0Aimport java.util.Collection;%0Aimport java.util.concurrent.ConcurrentHashMap;%0Aimport java.util.concurrent.atomic.AtomicBoolean;%0A%0Apublic final class PersistentHashMapInMemory%3CKey, Value%3E implements PersistentHashMapBase%3CKey, Value%3E %7B%0A  private final Object myLock = new Object();%0A%0A  private final ConcurrentHashMap%3CKey, Value%3E myMap = new ConcurrentHashMap%3C%3E();%0A  private final AtomicBoolean myIsClosed = new AtomicBoolean(false);%0A  private final AtomicBoolean myIsDirty = new AtomicBoolean(false);%0A%0A  @Override%0A  public boolean isCorrupted() %7B%0A    return false;%0A  %7D%0A%0A  public @NotNull Object getDataAccessLock() %7B%0A    return myLock;%0A  %7D%0A%0A  @Override%0A  public void dropMemoryCaches() %7B%0A%0A  %7D%0A%0A  @Override%0A  public void deleteMap() %7B%0A    myMap.clear();%0A  %7D%0A%0A  @Override%0A  public void put(Key key, Value value) throws IOException %7B%0A    myMap.put(key, value);%0A  %7D%0A%0A  @Override%0A  public void appendData(Key key, @NotNull ValueDataAppender appender) throws IOException %7B%0A    //TODO: how could we append data? Why binary only?%0A  %7D%0A%0A  @Override%0A  public boolean processKeys(@NotNull Processor%3C? super Key%3E processor) throws IOException %7B%0A    return processKeysWithExistingMapping(processor);%0A  %7D%0A%0A  @Override%0A  public boolean isDirty() %7B%0A    return myIsDirty.get();%0A  %7D%0A%0A  @Override%0A  public void markDirty() throws IOException %7B%0A    myIsDirty.set(true);%0A  %7D%0A%0A  @Override%0A  public @NotNull Collection%3CKey%3E getAllKeysWithExistingMapping() throws IOException %7B%0A    return myMap.keySet();%0A  %7D%0A%0A  @Override%0A  public boolean processKeysWithExistingMapping(@NotNull Processor%3C? super Key%3E processor) throws IOException %7B%0A    for (Key key : getAllKeysWithExistingMapping()) %7B%0A      if (!processor.process(key)) return false;%0A    %7D%0A    return true;%0A  %7D%0A%0A  @Override%0A  public Value get(Key key) throws IOException %7B%0A    return myMap.get(key);%0A  %7D%0A%0A  @Override%0A  public boolean containsMapping(Key key) throws IOException %7B%0A    return myMap.containsKey(key);%0A  %7D%0A%0A  @Override%0A  public void remove(Key key) throws IOException %7B%0A    myMap.remove(key);%0A  %7D%0A%0A  @Override%0A  public void force() %7B%0A%0A  %7D%0A%0A  @Override%0A  public boolean isClosed() %7B%0A    return myIsClosed.get();%0A  %7D%0A%0A  @Override%0A  public void close() throws IOException %7B%0A    myIsClosed.set(true);%0A  %7D%0A%7D%0A

add in-memory implementation (but appendValue is missing)