Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kotlinx-io API as a trimmed-down Okio API #132

Closed
fzhinkin opened this issue Jun 12, 2023 · 7 comments · Fixed by #136
Closed

kotlinx-io API as a trimmed-down Okio API #132

fzhinkin opened this issue Jun 12, 2023 · 7 comments · Fixed by #136
Assignees
Milestone

Comments

@fzhinkin
Copy link
Collaborator

fzhinkin commented Jun 12, 2023

As a starting point for #131, kotlinx-io API should be implemented as a trimmed-down version for Okio API. The API should include only core IO primitives and allow to build any other functionality on top of it.

Parts of the Okio API that are likely to be removed include:

  • select API;
  • hash functions API;
  • cursor API;
  • ByteStrings (will be added back later).

Some of these APIs provide specific functionality required by particular libraries and apps and could be implemented on top of the existing API; others are unsafe and should be redesigned to reduce possible user issues. It's also clear that these APIs were implemented as part of the core Okio library to squeeze additional performance out of it. To make sure that these APIs can be implemented using kotlinx-io without the loss of performance, the new APIs will be introduced in the future (or, if there will be no other way to implement removed functionality efficiently, it may be added back to the kotlinx-io).

The goal is to provide concise, well-documented and tested API. Core IO primitives API, like sources and sinks, should include as little functionality as possible; everything that could be implemented on top of it should be moved to extension functions or removed.

@fzhinkin fzhinkin added this to the 0.2.0 milestone Jun 12, 2023
@fzhinkin fzhinkin self-assigned this Jun 12, 2023
@SPC-code
Copy link

Kotlinx-io Input/Output are much more powerful than okio primitives. Will it be possible to separate API and implementation in this regard? I also would like to see separate API artifact and separate implementation for IO in general.

@qwwdfsad
Copy link
Contributor

I would suggest starting with use cases that you are solving with an API (either Okio and/or obsolete Input/Output) to help us shape the overall direction. The same question stands for the implementation -- what exactly you do want to implement?

@SPC-code
Copy link

@qwwdfsad I have two primary use-cases:

The first one already uses ktor-io extensively (I also use my own Binary extension which I need for composite formats. The second one uses buffer pulling and packets, but I am not fully happy with API yet.

@SPC-code
Copy link

As for separate API and implementation. It is important since kotlinx-io will probably be a base for a lot of solutions in Kotlin. It is quite possible, that we will want to use something different from okio in future (like it happened many times before with other technologies). I would like to be able to use api-only dependencies and choose implementation details later.

@qwwdfsad
Copy link
Contributor

I have two primary use-cases

These two use cases will be solvable with the proposed API shape and similar performance characteristics, I do not see issues with the proposed Okio-based design right off the bat.

@SPC-code
Copy link

Okio Source and Sink are similar to Input and Output. But last time I tried, something did not work as I wanted. I will play with a prototype to report specific problems.

@qwwdfsad
Copy link
Contributor

qwwdfsad commented Jun 14, 2023

We are happy to have any feedback about the API, and are keen on addressing known and yet unknown problems, whether they are about API shape, naming or performance characteristics.
We'll do an initial release soon, and I suggest you try it.

Yet please consider being a bit more constructive -- the feedback "This API is more powerful, and it would be nice to address it" is non-actionable for us, and we cannot reasonably evolve based on it

@fzhinkin fzhinkin linked a pull request Jun 23, 2023 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants