org.mapdb.StoreReadOnlyWrapper.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mapdb Show documentation
Show all versions of mapdb Show documentation
MapDB provides concurrent Maps, Sets and Queues backed by disk storage or off-heap memory. It is a fast, scalable and easy to use embedded Java database.
package org.mapdb
/**
* Wraps Store and throws `UnsupportedOperationException("Read-only")` on operations which would modify it
*/
class StoreReadOnlyWrapper(protected val store:Store):Store{
override fun close() {
store.close()
}
override fun commit() {
throw UnsupportedOperationException("Read-only")
}
override fun compact() {
throw UnsupportedOperationException("Read-only")
}
override fun compareAndSwap(recid: Long, expectedOldRecord: R?, newRecord: R?, serializer: Serializer): Boolean {
throw UnsupportedOperationException("Read-only")
}
override fun delete(recid: Long, serializer: Serializer) {
throw UnsupportedOperationException("Read-only")
}
override val isClosed: Boolean
get() = store.isClosed
override val isThreadSafe: Boolean
get() = store.isThreadSafe
override val isReadOnly = true
override fun preallocate(): Long {
throw UnsupportedOperationException("Read-only")
}
override fun put(record: R?, serializer: Serializer): Long {
throw UnsupportedOperationException("Read-only")
}
override fun update(recid: Long, record: R?, serializer: Serializer) {
throw UnsupportedOperationException("Read-only")
}
override fun verify() {
store.verify()
}
override fun get(recid: Long, serializer: Serializer): R? {
return store.get(recid, serializer)
}
override fun getAllRecids(): LongIterator {
return store.getAllRecids()
}
override fun fileLoad() = store.fileLoad()
override fun getAllFiles() = store.getAllFiles()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy