Repository: ktorio/ktor
File: ktor-client/ktor-client-core/common/src/io/ktor/client/engine/HttpClientEngine.kt (Kotlin)

Code before:
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.request.*
import io.ktor.client.utils.*
import io.ktor.http.*
import io.ktor.util.*
import io.ktor.utils.io.*
import io.ktor.utils.io.core.*
import kotlinx.coroutines.*
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.coroutineContext

internal val CALL_COROUTINE = CoroutineName("call-context")
internal val CLIENT_CONFIG = AttributeKey<HttpClientConfig<*>>("client-config")

/**
 * Serves as the base interface for an [HttpClient]'s engine.
 *
 * An `HttpClientEngine` represents the underlying network implementation that
 * performs HTTP requests and handles responses.
 * Developers can implement this interface to create custom engines for use with [HttpClient].
 *
 * This interface provides a set of properties and methods that define the
 * contract for configuring, executing, and managing HTTP requests within the engine.
 *
 * See also [HttpClientEngineBase] for a base implementation that handles common engine functionality.
 */
public interface HttpClientEngine : CoroutineScope, Closeable {
    /**
     * Specifies the [CoroutineDispatcher] for I/O operations in the engine.
     *
     * This dispatcher is used for all network-related operations, such as
     * sending requests and receiving responses.
     * By default, it should be optimized for I/O tasks.
     *
     * Example:
     * ```kotlin
     * override val dispatcher: CoroutineDispatcher = Dispatchers.IO
     * ```
     */
    public val dispatcher: CoroutineDispatcher

    /**
     * Provides access to the engine's configuration via [HttpClientEngineConfig].
     *
     * The [config] object stores user-defined parameters or settings that control
     * how the engine operates. When creating a custom engine, this property
     * should return the specific configuration implementation.
     *
     * Example:
     * ```kotlin

Review comment (suggestion):
```suggestion
 * For a base implementation that handles common engine functionality, see [HttpClientEngineBase].
```

Code after:
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.request.*
import io.ktor.client.utils.*
import io.ktor.http.*
import io.ktor.util.*
import io.ktor.utils.io.*
import io.ktor.utils.io.core.*
import kotlinx.coroutines.*
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.coroutineContext

internal val CALL_COROUTINE = CoroutineName("call-context")
internal val CLIENT_CONFIG = AttributeKey<HttpClientConfig<*>>("client-config")

/**
 * Serves as the base interface for an [HttpClient]'s engine.
 *
 * An `HttpClientEngine` represents the underlying network implementation that
 * performs HTTP requests and handles responses.
 * Developers can implement this interface to create custom engines for use with [HttpClient].
 *
 * This interface provides a set of properties and methods that define the
 * contract for configuring, executing, and managing HTTP requests within the engine.
 *
 * For a base implementation that handles common engine functionality, see [HttpClientEngineBase].
 */
public interface HttpClientEngine : CoroutineScope, Closeable {
    /**
     * Specifies the [CoroutineDispatcher] for I/O operations in the engine.
     *
     * This dispatcher is used for all network-related operations, such as
     * sending requests and receiving responses.
     * By default, it should be optimized for I/O tasks.
     *
     * Example:
     * ```kotlin
     * override val dispatcher: CoroutineDispatcher = Dispatchers.IO
     * ```
     */
    public val dispatcher: CoroutineDispatcher

    /**
     * Provides access to the engine's configuration via [HttpClientEngineConfig].
     *
     * The [config] object stores user-defined parameters or settings that control
     * how the engine operates. When creating a custom engine, this property
     * should return the specific configuration implementation.
     *
     * Example:
     * ```kotlin