ktor-utils / io.ktor.util.pipeline

Package io.ktor.util.pipeline

Types

Pipeline

open class Pipeline<TSubject : Any, TContext : Any>

Represents an execution pipeline for asynchronous extensible computations

PipelineContext

interface PipelineContext<TSubject : Any, TContext : Any> : CoroutineScope

Represents running execution of a pipeline

PipelineExecutor

interface PipelineExecutor<R>

Represent an object that launches pipeline execution

PipelinePhase

class PipelinePhase

Represents a phase in a pipeline

Annotations

ContextDsl

annotation class ContextDsl

DslMarker for pipeline execution context

Exceptions

InvalidPhaseException

class InvalidPhaseException : Throwable

An exception about misconfigured phases in a pipeline

Type Aliases

PipelineInterceptor

typealias PipelineInterceptor<TSubject, TContext> = suspend PipelineContext<TSubject, TContext>.(TSubject) -> Unit

Represents an interceptor type which is a suspend extension function for context

Functions

execute

suspend fun <TContext : Any> Pipeline<Unit, TContext>.execute(context: TContext): Unit

Executes this pipeline

intercept

fun <TSubject : Any, TContext : Any> Pipeline<*, TContext>.intercept(phase: PipelinePhase, block: suspend PipelineContext<TSubject, TContext>.(TSubject) -> Unit): Unit

Intercepts an untyped pipeline when the subject is of the given type

pipelineExecutorFor

fun <TSubject : Any, TContext : Any> pipelineExecutorFor(context: TContext, interceptors: List<PipelineInterceptor<TSubject, TContext>>, subject: TSubject): PipelineExecutor<TSubject>

Build a pipeline of the specified interceptors and create executor