Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package org.jacodb.api.jvm

import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toPersistentList
import org.jacodb.api.caches.ValueStoreType
import java.io.File
import java.time.Duration

Expand Down Expand Up @@ -186,8 +187,6 @@ data class JcCacheSegmentSettings(
val expiration: Duration = Duration.ofMinutes(1)
)

enum class ValueStoreType { WEAK, SOFT, STRONG }

class JcCacheSettings {
var cacheSpiId: String? = null
var classes: JcCacheSegmentSettings = JcCacheSegmentSettings()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.jacodb.impl.caches
package org.jacodb.api.caches

import org.jacodb.api.spi.CommonSPI
import org.jacodb.api.spi.SPILoader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
* limitations under the License.
*/

package org.jacodb.impl.caches
package org.jacodb.api.caches

import org.jacodb.api.jvm.ValueStoreType
import java.time.Duration

enum class ValueStoreType { WEAK, SOFT, STRONG }

class PluggableCacheException(message: String) : RuntimeException(message)

interface PluggableCache<K : Any, V : Any> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package org.jacodb.testing.performance.caches

import kotlinx.benchmark.Blackhole
import org.jacodb.api.jvm.ValueStoreType
import org.jacodb.impl.caches.PluggableCache
import org.jacodb.api.caches.PluggableCache
import org.jacodb.api.caches.ValueStoreType
import org.jacodb.impl.caches.xodus.XODUS_CACHE_PROVIDER_ID
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.BenchmarkMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
package org.jacodb.impl.features.classpaths

import mu.KLogging
import org.jacodb.api.caches.PluggableCache
import org.jacodb.api.caches.PluggableCacheProvider
import org.jacodb.api.caches.PluggableCacheStats
import org.jacodb.api.jvm.JcCacheSegmentSettings
import org.jacodb.api.jvm.JcCacheSettings
import org.jacodb.api.jvm.JcClassType
Expand All @@ -35,9 +38,6 @@ import org.jacodb.api.jvm.cfg.JcInst
import org.jacodb.api.jvm.cfg.JcInstList
import org.jacodb.api.jvm.cfg.JcRawInst
import org.jacodb.api.jvm.ext.JAVA_OBJECT
import org.jacodb.impl.caches.PluggableCache
import org.jacodb.impl.caches.PluggableCacheProvider
import org.jacodb.impl.caches.PluggableCacheStats
import org.jacodb.impl.caches.xodus.XODUS_CACHE_PROVIDER_ID
import org.jacodb.impl.features.classpaths.AbstractJcInstResult.JcFlowGraphResultImpl
import org.jacodb.impl.features.classpaths.AbstractJcInstResult.JcInstListResultImpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

package org.jacodb.impl.storage

import org.jacodb.api.caches.PluggableCache
import org.jacodb.api.caches.PluggableCacheProvider
import org.jacodb.api.jvm.JcByteCodeLocation
import org.jacodb.api.jvm.JcDatabasePersistence
import org.jacodb.api.jvm.RegisteredLocation
import org.jacodb.api.storage.ers.getEntityOrNull
import org.jacodb.impl.caches.PluggableCache
import org.jacodb.impl.caches.PluggableCacheProvider
import org.jacodb.impl.caches.xodus.XODUS_CACHE_PROVIDER_ID
import org.jacodb.impl.fs.JavaRuntime
import org.jacodb.impl.fs.asByteCodeLocation
Expand Down Expand Up @@ -73,7 +73,7 @@
).mapNotNull {
try {
File(it.path).asByteCodeLocation(javaRuntime.version, isRuntime = it.runtime)
} catch (e: Exception) {
} catch (_: Exception) {

Check warning on line 76 in jacodb-core/src/main/kotlin/org/jacodb/impl/storage/AbstractJcDbPersistence.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-core/src/main/kotlin/org/jacodb/impl/storage/AbstractJcDbPersistence.kt#L76

Added line #L76 was not covered by tests
null
}
}.flatten().distinct()
Expand Down Expand Up @@ -131,7 +131,7 @@
override fun close() {
try {
symbolInterner.close()
} catch (e: Exception) {
} catch (_: Exception) {

Check warning on line 134 in jacodb-core/src/main/kotlin/org/jacodb/impl/storage/AbstractJcDbPersistence.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-core/src/main/kotlin/org/jacodb/impl/storage/AbstractJcDbPersistence.kt#L134

Added line #L134 was not covered by tests
// ignore
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.jacodb.testing.caches

import org.jacodb.impl.caches.PluggableCache
import org.jacodb.api.caches.PluggableCache
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.BeforeEach
Expand Down
3 changes: 2 additions & 1 deletion jacodb-storage/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ dependencies {
compileOnly(Libs.xodusEnvironment)
compileOnly(Libs.lmdb_java)
compileOnly(Libs.rocks_db)

compileOnly(Libs.guava)
compileOnly(Libs.xodusUtils)

testImplementation(Libs.xodusEnvironment)
testImplementation(Libs.lmdb_java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ package org.jacodb.impl.caches.guava

import com.google.common.cache.Cache
import com.google.common.cache.CacheBuilder
import org.jacodb.api.jvm.ValueStoreType
import org.jacodb.impl.caches.PluggableCache
import org.jacodb.impl.caches.PluggableCacheBuilder
import org.jacodb.impl.caches.PluggableCacheProvider
import org.jacodb.impl.caches.PluggableCacheStats
import java.time.Duration
import org.jacodb.api.caches.PluggableCache
import org.jacodb.api.caches.PluggableCacheBuilder
import org.jacodb.api.caches.PluggableCacheProvider
import org.jacodb.api.caches.PluggableCacheStats
import org.jacodb.api.caches.ValueStoreType

const val GUAVA_CACHE_PROVIDER_ID = "org.jacodb.impl.caches.guava.GuavaCacheProvider"

Expand All @@ -42,7 +41,7 @@ private class GuavaCacheBuilder<K : Any, V : Any> : PluggableCacheBuilder<K, V>(
.maximumSize(maximumSize.toLong())
.apply {
expirationDuration.let {
if (it != Duration.ZERO) {
if (it != java.time.Duration.ZERO) {
expireAfterAccess(it)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ package org.jacodb.impl.caches.xodus
import jetbrains.exodus.core.dataStructures.ConcurrentObjectCache
import jetbrains.exodus.core.dataStructures.ObjectCacheBase
import jetbrains.exodus.core.dataStructures.SoftConcurrentObjectCache
import org.jacodb.api.jvm.ValueStoreType
import org.jacodb.impl.caches.PluggableCache
import org.jacodb.impl.caches.PluggableCacheBuilder
import org.jacodb.impl.caches.PluggableCacheException
import org.jacodb.impl.caches.PluggableCacheProvider
import org.jacodb.impl.caches.PluggableCacheStats
import org.jacodb.api.caches.PluggableCache
import org.jacodb.api.caches.PluggableCacheBuilder
import org.jacodb.api.caches.PluggableCacheException
import org.jacodb.api.caches.PluggableCacheProvider
import org.jacodb.api.caches.PluggableCacheStats
import org.jacodb.api.caches.ValueStoreType

const val XODUS_CACHE_PROVIDER_ID = "org.jacodb.impl.caches.xodus.XodusCacheProvider"

Expand All @@ -51,7 +51,7 @@ private class XodusCacheBuilder<K : Any, V : Any> : PluggableCacheBuilder<K, V>(
}

/**
* Generally, Xodus' [ObjectCacheBase] is not synchronized, but [XodusCacheBuilder] creates
* Generally, Xodus' [jetbrains.exodus.core.dataStructures.ObjectCacheBase] is not synchronized, but [XodusCacheBuilder] creates
* its "concurrent" implementations which do not require synchronization. If this ever changes,
* [XodusCache] should be synchronized.
*/
Expand Down
Loading