Pass keyDescriptor to BasicMap using constructor
Original commit: a660562743
This commit is contained in:
@@ -601,10 +601,7 @@ public class IncrementalCacheImpl(
|
|||||||
override fun dumpValue(value: Boolean) = ""
|
override fun dumpValue(value: Boolean) = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class SourceToClassesMap(storageFile: File) : BasicStringMap<List<String>>(storageFile, StringListExternalizer) {
|
private inner class SourceToClassesMap(storageFile: File) : BasicStringMap<List<String>>(storageFile, PathStringDescriptor.INSTANCE, StringListExternalizer) {
|
||||||
override val keyDescriptor: KeyDescriptor<String>
|
|
||||||
get() = PathStringDescriptor.INSTANCE
|
|
||||||
|
|
||||||
public fun clearOutputsForSource(sourceFile: File) {
|
public fun clearOutputsForSource(sourceFile: File) {
|
||||||
storage.remove(sourceFile.getAbsolutePath())
|
storage.remove(sourceFile.getAbsolutePath())
|
||||||
}
|
}
|
||||||
@@ -676,10 +673,7 @@ public class IncrementalCacheImpl(
|
|||||||
* * inlineFunction - jvmSignature of some inline function in source file
|
* * inlineFunction - jvmSignature of some inline function in source file
|
||||||
* * target files - collection of files inlineFunction has been inlined to
|
* * target files - collection of files inlineFunction has been inlined to
|
||||||
*/
|
*/
|
||||||
private inner class InlineFunctionsFilesMap(storageFile: File) : BasicMap<PathFunctionPair, Collection<String>>(storageFile, PathCollectionExternalizer) {
|
private inner class InlineFunctionsFilesMap(storageFile: File) : BasicMap<PathFunctionPair, Collection<String>>(storageFile, PathFunctionPairKeyDescriptor, PathCollectionExternalizer) {
|
||||||
override val keyDescriptor: KeyDescriptor<PathFunctionPair>
|
|
||||||
get() = PathFunctionPairKeyDescriptor
|
|
||||||
|
|
||||||
public fun add(sourcePath: String, jvmSignature: String, targetPath: String) {
|
public fun add(sourcePath: String, jvmSignature: String, targetPath: String) {
|
||||||
val key = PathFunctionPair(sourcePath, jvmSignature)
|
val key = PathFunctionPair(sourcePath, jvmSignature)
|
||||||
storage.appendData(key) { out ->
|
storage.appendData(key) { out ->
|
||||||
|
|||||||
@@ -27,10 +27,9 @@ import java.io.IOException
|
|||||||
|
|
||||||
public abstract class BasicMap<K : Comparable<K>, V>(
|
public abstract class BasicMap<K : Comparable<K>, V>(
|
||||||
private val storageFile: File,
|
private val storageFile: File,
|
||||||
|
private val keyDescriptor: KeyDescriptor<K>,
|
||||||
private val valueExternalizer: DataExternalizer<V>
|
private val valueExternalizer: DataExternalizer<V>
|
||||||
) {
|
) {
|
||||||
protected abstract val keyDescriptor: KeyDescriptor<K>
|
|
||||||
|
|
||||||
protected var storage: PersistentHashMap<K, V> = createMap()
|
protected var storage: PersistentHashMap<K, V> = createMap()
|
||||||
|
|
||||||
public fun contains(key: K): Boolean = storage.containsMapping(key)
|
public fun contains(key: K): Boolean = storage.containsMapping(key)
|
||||||
@@ -92,10 +91,13 @@ public abstract class BasicMap<K : Comparable<K>, V>(
|
|||||||
|
|
||||||
public abstract class BasicStringMap<V>(
|
public abstract class BasicStringMap<V>(
|
||||||
storageFile: File,
|
storageFile: File,
|
||||||
|
keyDescriptor: KeyDescriptor<String>,
|
||||||
valueExternalizer: DataExternalizer<V>
|
valueExternalizer: DataExternalizer<V>
|
||||||
) : BasicMap<String, V>(storageFile, valueExternalizer) {
|
) : BasicMap<String, V>(storageFile, keyDescriptor, valueExternalizer) {
|
||||||
override val keyDescriptor: KeyDescriptor<String>
|
public constructor(
|
||||||
get() = EnumeratorStringDescriptor()
|
storageFile: File,
|
||||||
|
valueExternalizer: DataExternalizer<V>
|
||||||
|
) : this(storageFile, EnumeratorStringDescriptor.INSTANCE, valueExternalizer)
|
||||||
|
|
||||||
override fun dumpKey(key: String): String = key
|
override fun dumpKey(key: String): String = key
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user