CompletableFutureArtifactService

Java-friendly wrapper around an ArtifactService that it owns: each method calls the suspend method of the same name and returns a CompletableFuture of its result, so Java callers never pass a Continuation. Each call runs in the caller's OpenTelemetry context and in the coroutineContext passed to it, such as MDCContext() from kotlinx-coroutines-slf4j to carry the caller's MDC. Canceling a future cancels its call, a Job in coroutineContext is ignored, and close cancels every call in flight, then closes the service if it is AutoCloseable.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard

The wrapped artifact service, for code that has dropped into Kotlin.

Link copied to clipboard
open override fun close()

Cancels calls in flight, then closes the service if it is AutoCloseable. Every later call returns a canceled future.

Link copied to clipboard
fun deleteArtifact(sessionKey: SessionKey, filename: String, coroutineContext: CoroutineContext = EmptyCoroutineContext): CompletableFuture<Void?>
Link copied to clipboard
fun listArtifactKeys(sessionKey: SessionKey, coroutineContext: CoroutineContext = EmptyCoroutineContext): CompletableFuture<List<String>>
Link copied to clipboard
fun listVersions(sessionKey: SessionKey, filename: String, coroutineContext: CoroutineContext = EmptyCoroutineContext): CompletableFuture<List<Int>>
Link copied to clipboard
fun loadArtifact(sessionKey: SessionKey, filename: String, version: Int? = null, coroutineContext: CoroutineContext = EmptyCoroutineContext): CompletableFuture<Part?>

Calls ArtifactService.loadArtifact, which loads the latest version when version is null. The future completes with null if there is no such artifact.

Link copied to clipboard
fun saveAndReloadArtifact(sessionKey: SessionKey, filename: String, artifact: Part, coroutineContext: CoroutineContext = EmptyCoroutineContext): CompletableFuture<Part>
Link copied to clipboard
fun saveArtifact(sessionKey: SessionKey, filename: String, artifact: Part, coroutineContext: CoroutineContext = EmptyCoroutineContext): CompletableFuture<Int>

Calls ArtifactService.saveArtifact; the future completes with the saved version.