wireSerializer

fun <V> wireSerializer(vSerializer: KSerializer<V>): KSerializer<Rga<V>>

Returns a kotlinx.serialization.KSerializer for Rga<V> that correctly threads vSerializer through the op-log serialization, avoiding the CBOR polymorphism limitation of the compiler-generated Rga$$serializer.

Use this instead of Rga.serializer(...) when wiring Rga into a us.tractat.kuilt.quilter.Quilter — the generated serializer fails for CBOR transport because it defaults to PolymorphicSerializer(Any::class) for the element type V in RgaOp.Insert.value.

Usage:

val msgSer = QuiltMessage.serializer(Rga.wireSerializer(serializer<String>()))
val replicator = Quilter(..., messageSerializer = msgSer)

Parameters

vSerializer

the kotlinx.serialization.KSerializer for element type V.