Kotlinx.coroutines: Channels as a generic bytestream abstraction

Created on 16 Jul 2019  路  4Comments  路  Source: Kotlin/kotlinx.coroutines

As the title states, I'm looking at using channels as a generic bytestream abstraction. I want to use it for an upcoming networking stack implementation - things like chunking, delimited reading, multiplexing, all seem to be a good fit for channels. However, I'm not sure if that is it's intended use and weather it would lead to a brittle/clunky design. In addition, I've ran across https://github.com/Kotlin/kotlinx-io, which though it exposes a channel abstraction, it is radically different to that provided by this library.

My questions are:

  • Are channels, flexible enough to allow usage as a generic stream interface for byte manipulation?

    • My impression, is that at least from a _convenience_ point of view, the interface is flexible enough to accomodate for all of that. On top of that, the build in backpressure is a wellcome feature.

  • Following from the previous question - would this be their intended usage?
  • If all of the above is true, why was https://github.com/Kotlin/kotlinx-io not implemented with "pure" channels and instead opted for their own abstraction (I believe this is an official kotlin library?)
question

Most helpful comment

You can watch https://github.com/Kotlin/kotlinx-io for updates.

All 4 comments

Channel<Byte> is an extremely slow IO absraction, that is why a dedicated IO abstraction is being developed as a part of kotlinx-io project.

Any word on the status of the new io abstraction, where can I learn more about it?

@elizarov Is it being developed publicly, would you be so kind pointing me where its taking place?

You can watch https://github.com/Kotlin/kotlinx-io for updates.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tolriq picture Tolriq  路  50Comments

elizarov picture elizarov  路  62Comments

streetsofboston picture streetsofboston  路  40Comments

LouisCAD picture LouisCAD  路  64Comments

elizarov picture elizarov  路  40Comments