SubserviceTransformer

class SubserviceTransformer<T : RpcService>(val serviceObject: RpcObject<T>, val typeArgSerializers: List<KSerializer<*>> = emptyList()) : BaseSubserviceTransformer<T, T>

Constructors

Link copied to clipboard
constructor(serviceObject: RpcObject<T>, typeArgSerializers: List<KSerializer<*>> = emptyList())

Properties

Link copied to clipboard
Link copied to clipboard
open override val serviceObject: RpcObject<T>
Link copied to clipboard
open override val typeArgSerializers: List<KSerializer<*>>

Serializers for the type arguments of the sub-service, in declaration order. For example, FlowSubserviceTransformer<Update> returns the KSerializer<Update>. Non-generic sub-services return an empty list (the default).

Functions

Link copied to clipboard
open suspend override fun <S> transform(input: T, channel: SerializedService<S>): CallData<S>
Link copied to clipboard
open suspend fun <S> transformOutcome(output: T, channel: SerializedService<S>, encodeError: (Throwable) -> CallData.Error<S>): CallData<S>

Server-side boundary hook (issue #133). Invoked by RpcMethod.call with the value returned by the handler. The default implementation simply delegates to transform; transformers that need to observe the failure channel (e.g. ResultTransformer for Result<O> return types) override this to fold a returned failure into the wire-level error frame via encodeError.

Link copied to clipboard
open suspend override fun <S> untransform(data: CallData<S>, channel: SerializedService<S>): T
Link copied to clipboard
open suspend fun <S> untransformOutcome(data: CallData<S>, channel: SerializedService<S>, decodeError: (CallData.Error<S>) -> Throwable): T

Client-side boundary hook (issue #133). Invoked by RpcMethod.callChannel with the raw wire response (which may be a CallData.Error). The default implementation throws the decoded error — preserving today's behaviour — and otherwise delegates to untransform. ResultTransformer overrides this to wrap the outcome in a kotlin.Result instead of throwing.