@Override
  @ApiStatus.Internal
  public @NotNull UpdatableIndex<Integer, SerializedStubTree, FileContent, ?> createIndexImplementation(final @NotNull FileBasedIndexExtension<Integer, SerializedStubTree> extension,
                                                                                                        @NotNull VfsAwareIndexStorageLayout<Integer, SerializedStubTree> layout)
    throws StorageException, IOException {
    ((StubIndexEx)StubIndex.getInstance()).initializeStubIndexes();
    checkNameStorage();
    mySerializationManager.initialize();

    MapReduceIndexBase<Integer, SerializedStubTree, ?> index = StubUpdatableIndexFactory.getInstance().createIndex(extension, new VfsAwareIndexStorageLayout<>() {
      @Override
      public void clearIndexData() {
        layout.clearIndexData();
      }

      @Override
      public @NotNull IndexStorage<Integer, SerializedStubTree> openIndexStorage() throws IOException {
        return layout.openIndexStorage();
      }

      @Override
      public @Nullable ForwardIndex openForwardIndex() throws IOException {
        return layout.openForwardIndex();
      }

      @Override
      public @NotNull ForwardIndexAccessor<Integer, SerializedStubTree> getForwardIndexAccessor() {
        return new StubUpdatingForwardIndexAccessor(extension);
      }
    }, mySerializationManager);
    if (index.getStorage() instanceof TransientChangesIndexStorage<Integer, SerializedStubTree> memStorage) {
      memStorage.addBufferingStateListener(new TransientChangesIndexStorage.BufferingStateListener() {
        @Override
        public void bufferingStateChanged(final boolean newState) {
          ((StubIndexEx)StubIndex.getInstance()).setDataBufferingEnabled(newState);
        }

        @Override
        public void memoryStorageCleared() {
          ((StubIndexEx)StubIndex.getInstance()).cleanupMemoryStorage();
        }
      });
    }
    return index;
  }
@Override
  @ApiStatus.Internal
  public @NotNull UpdatableIndex<Integer, SerializedStubTree, FileContent, ?> createIndexImplementation(final @NotNull FileBasedIndexExtension<Integer, SerializedStubTree> extension,
                                                                                                        @NotNull VfsAwareIndexStorageLayout<Integer, SerializedStubTree> layout)