xtdb.api.log.FileListCache.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xtdb-core Show documentation
Show all versions of xtdb-core Show documentation
An open source document database with bitemporal graph queries
package xtdb.api.log
import java.util.concurrent.CompletableFuture
interface FileListCache {
fun appendFileNotification(notification: Notification): CompletableFuture
fun subscribeFileNotifications(subscriber: Subscriber)
interface Notification
interface Subscriber {
fun onSubscribe(closeHook: AutoCloseable)
fun accept(record: Notification)
}
companion object {
@JvmField
val SOLO = object : FileListCache {
private var sub: Subscriber? = null
override fun appendFileNotification(notification: Notification): CompletableFuture {
sub?.accept(notification)
return CompletableFuture.completedFuture(Unit)
}
override fun subscribeFileNotifications(subscriber: Subscriber) {
sub = subscriber
subscriber.onSubscribe { sub = null }
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy