I have been poking io-2 for some time and I came t...
# io
a
I have been poking io-2 for some time and I came to conclusion that sooner or later we will need to introduce suspension into it in orde to read and write dynamic inputs and outputs like inputstreams and channels. So we have two solutions: either wrap everything in callbacks and then introduce binding to coroutines or make all read and write operations suspendable from the start. The actual suspension will be done during buffer fetch/flush, so it should not affect performance much. So far I think that making everything suspendable looks better.
e
The ultimate plan is to a separate set of primitives for suspendable input/output with essentially the same methods, but suspending. The reason for such separation is performace. In a typical scenario you’d parse your protocol header using suspending primitives, then read the whole block of application data into memory, then deserialize it (fast) using non-suspendable primitives (we don’t plan to support suspension in serialization)
a
Do you mean to implement it as a separate
SuspendedInput
or as a suspended method inside existing input?
e
There going to be
InputChannel
just like in IO 0.1.
a
OK, I will experiment around a bit. For now, I am just doing some necessary things from TODO
k
@elizarov when you say “we don’t plan to support suspension in serialization” are you talking about kotlin serialization?
e
Yes
k
i wish there were some sort of roadmap or more public info on this kotlinx-io library. I’ve been following it for over a year hoping to see a roadmap or maturity
a good portion of my job is writing network protocol implementations
so i see a lot of potential here
e
The road map is to finish it asap 🙂
🙏 1
k
lol 👍
I recently finished my first pure Kotlin implementation of a protocol. It went well. Some rough edges on the unsigned types but whatever.
right now I use Netty for all my implementations. I hope with kotlinx-io I can drop that and write implementations such that they are also multi-platform and usable from K/N
👌 1