public DetectedFrameworksData(Project project) { myDetectedFrameworks = new MultiMap<Integer, DetectedFrameworkDescription>(); File file = new File(FrameworkDetectorRegistryImpl.getDetectionDirPath() + File.separator + project.getName() + "." + project.getLocationHash() + File.separator + "files"); myNewFiles = new TIntObjectHashMap<TIntHashSet>(); try { myExistentFrameworkFiles = new PersistentHashMap<Integer, TIntHashSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new TIntHashSetExternalizer()); } catch (IOException e) { LOG.info(e); PersistentHashMap.deleteFilesStartingWith(file); try { myExistentFrameworkFiles = new PersistentHashMap<Integer, TIntHashSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new TIntHashSetExternalizer()); } catch (IOException e1) { LOG.error(e1); } } }
public Cache(@NonNls final String storePath, final int cacheSize) throws IOException { myStorePath = storePath; new File(storePath).mkdirs(); myQNameToClassInfoMap = new CachedPersistentHashMap<Integer, ClassInfo>(getOrCreateFile("classes"), EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer<ClassInfo>() { public void save(DataOutput out, ClassInfo value) throws IOException { value.save(out); } public ClassInfo read(DataInput in) throws IOException { return new ClassInfo(in); } }, cacheSize * 2) { protected boolean isValueDirty(ClassInfo classInfo) { return classInfo.isDirty(); } }; myDependencies = new BackwardDependenciesStorage(getOrCreateFile("bdeps"), cacheSize); myQNameToReferencedClassesMap = new CompilerDependencyStorage<Integer>(getOrCreateFile("fdeps"), EnumeratorIntegerDescriptor.INSTANCE, cacheSize); myQNameToSubclassesMap = new CompilerDependencyStorage<Integer>(getOrCreateFile("subclasses"), EnumeratorIntegerDescriptor.INSTANCE, cacheSize); myRemoteQNames = new PersistentHashMap<Integer, Boolean>(getOrCreateFile("remote"), EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer<Boolean>() { public void save(DataOutput out, Boolean value) throws IOException { out.writeBoolean(value.booleanValue()); } public Boolean read(DataInput in) throws IOException { return in.readBoolean(); } }, cacheSize); }
public MyMapReduceIndex(@Nonnull DataIndexer<Integer, T, VcsFullCommitDetails> indexer, @Nonnull DataExternalizer<T> externalizer, int version) throws IOException { super(new MyIndexExtension(indexer, externalizer, version), new MapIndexStorage<Integer, T>(getStorageFile(myName, myLogId), EnumeratorIntegerDescriptor.INSTANCE, externalizer, 5000, false) { @Override protected void checkCanceled() { ProgressManager.checkCanceled(); } }, new EmptyForwardIndex<>()); }
@Override public KeyDescriptor<Integer> getKeyDescriptor() { return EnumeratorIntegerDescriptor.INSTANCE; }
public MethodsUsageIndexReader(final Project project, final String canonicalIndexName, final int version) { //noinspection ConstantConditions super(EnumeratorIntegerDescriptor.INSTANCE, new TObjectIntHashMapExternalizer<EnumeratedMethodIncompleteSignature>(EnumeratedMethodIncompleteSignature.createDataExternalizer()), canonicalIndexName, version, project); }
@NotNull @Override public final KeyDescriptor<Integer> getKeyDescriptor() { return EnumeratorIntegerDescriptor.INSTANCE; }
@NotNull public KeyDescriptor<Integer> getKeyDescriptor() { return EnumeratorIntegerDescriptor.INSTANCE; }
@NotNull @Override public KeyDescriptor<Integer> getKeyDescriptor() { return EnumeratorIntegerDescriptor.INSTANCE; }
private static PersistentHashMap<Integer, Integer> createOrOpenMap() throws IOException { return new PersistentHashMap<Integer, Integer>(new File(tracingDataLocation), EnumeratorIntegerDescriptor.INSTANCE, EnumeratorIntegerDescriptor.INSTANCE); }
public TwinVariablesIndex() { super(new EnumeratorStringDescriptor(), new ArrayListKeyDescriptor<Integer>(EnumeratorIntegerDescriptor.INSTANCE)); }
public BackwardDependenciesStorage(File file, final int cacheSize) throws IOException { myMap = new PersistentHashMap<Integer, DependenciesSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new MyDataExternalizer()); myCache = new SLRUCache<Integer, ReferencerSetHolder>(cacheSize * 2, cacheSize) { @NotNull public ReferencerSetHolder createValue(Integer key) { return new ReferencerSetHolder(key); } protected void onDropFromCache(Integer key, final ReferencerSetHolder holder) { if (key.equals(myKeyToRemove) || !holder.isDirty()) { return; } try { if (holder.isDataLoaded() || !myMap.containsMapping(key)) { myMap.put(key, new DependenciesSet(holder.getData())); } else { myMap.appendData(key, new PersistentHashMap.ValueDataAppender() { public void append(final DataOutput out) throws IOException { final Ref<IOException> exception = new Ref<IOException>(null); // process removed holder.myRemoveRequested.forEach(new TIntProcedure() { public boolean execute(int qName) { try { out.writeInt(-qName); return true; } catch (IOException e) { exception.set(e); } return false; } }); final IOException _ex = exception.get(); if (_ex != null) { throw _ex; } // process added members for (ReferencerItem item : holder.myAdded) { item.save(out); } } }); } } catch (IOException e) { LOG.error(e); } } }; }
@Override public final KeyDescriptor<Integer> getKeyDescriptor() { return EnumeratorIntegerDescriptor.INSTANCE; }
@NotNull @Override public DataExternalizer<Integer> getValueExternalizer() { return EnumeratorIntegerDescriptor.INSTANCE; }
@Nonnull @Override public final KeyDescriptor<Integer> getKeyDescriptor() { return EnumeratorIntegerDescriptor.INSTANCE; }
@Nonnull @Override public KeyDescriptor<Integer> getKeyDescriptor() { return EnumeratorIntegerDescriptor.INSTANCE; }
@Nonnull public KeyDescriptor<Integer> getKeyDescriptor() { return EnumeratorIntegerDescriptor.INSTANCE; }
@Nonnull private static <K> PersistentHashMap<Integer, Collection<K>> createIdToDataKeysIndex(@Nonnull IndexExtension<K, ?, ?> extension) throws IOException { final File indexStorageFile = IndexInfrastructure.getInputIndexStorageFile((ID<?, ?>)extension.getName()); return new PersistentHashMap<>(indexStorageFile, EnumeratorIntegerDescriptor.INSTANCE, createInputsIndexExternalizer(extension)); }
public Cache(@NonNls final String storePath, final int cacheSize) throws IOException { myStorePath = storePath; new File(storePath).mkdirs(); myQNameToClassInfoMap = new CachedPersistentHashMap<Integer, ClassInfo>(getOrCreateFile("classes"), EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer<ClassInfo>() { @Override public void save(DataOutput out, ClassInfo value) throws IOException { value.save(out); } @Override public ClassInfo read(DataInput in) throws IOException { return new ClassInfo(in); } }, cacheSize * 2) { @Override protected boolean isValueDirty(ClassInfo classInfo) { return classInfo.isDirty(); } }; myDependencies = new BackwardDependenciesStorage(getOrCreateFile("bdeps"), cacheSize); myQNameToReferencedClassesMap = new CompilerDependencyStorage<Integer>(getOrCreateFile("fdeps"), EnumeratorIntegerDescriptor.INSTANCE, cacheSize); myQNameToSubclassesMap = new CompilerDependencyStorage<Integer>(getOrCreateFile("subclasses"), EnumeratorIntegerDescriptor.INSTANCE, cacheSize); myRemoteQNames = new PersistentHashMap<Integer, Boolean>(getOrCreateFile("remote"), EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer<Boolean>() { @Override public void save(DataOutput out, Boolean value) throws IOException { out.writeBoolean(value.booleanValue()); } @Override public Boolean read(DataInput in) throws IOException { return in.readBoolean(); } }, cacheSize); }