DotFunSerializer

class DotFunSerializer<V>(vSerializer: KSerializer<V>) : KSerializer<DotFun<V>>

Custom KSerializer for DotFun<V> that emits DotFun.values entries sorted by Dot key (lexicographically by replica, then by seq), producing identical bytes for any two replicas at the same logical state regardless of delivery order.

Wire format: Map<Dot, V> — same structural layout as the auto-generated serializer, but with entries emitted in a canonical sorted order.

The auto-generated serializer is delivery-order-dependent because DotFun.join builds a LinkedHashMap whose iteration order depends on which side is self vs other in the merge. Sorting before encoding makes the wire form a function of the logical value.

This is the serializer selected by @Serializable(with = DotFunSerializer::class) on DotFun. Callers obtain an instance via DotFun.serializer(valueSerializer).

Sort order: sortedByCanonicalKey, the one canonical order shared with CanonicalMapSerializer and the rest of the dot family (#1964). It is byte-identical to the sortedBy { dot } it replaced — see DotSetSerializer.

Constructors

Link copied to clipboard
constructor(vSerializer: KSerializer<V>)

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): DotFun<V>
Link copied to clipboard
open override fun serialize(encoder: Encoder, value: DotFun<V>)