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

Update deps and migrate from okio to kotlinx.io #112

Closed
wants to merge 4 commits into from

Conversation

mani1232
Copy link
Contributor

No description provided.

@mani1232
Copy link
Contributor Author

mani1232 commented Jul 12, 2024

Temp repo:

maven {
    name = "worldmandiaRepositoryReleases"
    url = uri("https://repo.worldmandia.cc/releases")
}
implementation("io.github.xxfast:kstore:0.8.0")

Copy link
Owner

@xxfast xxfast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the contribution 🙇

import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationStrategy

public abstract class KStoreFormat<T : @Serializable Any>(public val serializer: KSerializer<T>) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we need this intermediary class instead of passing in the serialiser directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all formats support KotlinX.IO

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello.
It would be premature to support custom serializers, becouse kotlinx.serialization is currently stable with only the Json serializer.

It may be possible to use a protocolbuffers/protobuf serializer like Jetpack DataStore, but is that level of customizability necessary?

In any case, support for custom serializers is not important when migrating from Okio to kotlinx.io, so this should be considered in a new pull request.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as before you do not need to change this, since there is a JSON serializer, this is simply done if you really need to change this, kotlinx.io allows you to convert this to java bytearray and/or string

Copy link

@8cAyqpVKio 8cAyqpVKio Aug 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as before you do not need to change this, since there is a JSON serializer,

I see there are no breaking updates on this.
I see there are no breaking updates on this, except for argument name changes such as kstore.file.storeOf.

this is simply done if you really need to change this, kotlinx.io allows you to convert this to java bytearray and/or string

I don't see any reason to bother writing your own EncodeToSink to encode to a Java ByteArray and/or String. Wouldn't Json encoding be enough?
For large datasets, ProtoBuf is a good choice, but as I mentioned in the previous comment, kotlinx.serialization's ProtoBuf is not stable. Google's protocolbuffers/protobuf is stable but only supports the JVM.

It should remain simple and tiny without adding unnecessary customizability, I think.

In any case, support for custom serializers is not important when migrating from Okio to kotlinx.io, so this should be considered in a new pull request.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah prolly best if we do this separately - and I agree we would need some abstraction to handle multiple formats, but we will cross that bridge when we get there

@xxfast xxfast self-requested a review August 14, 2024 05:42
@xxfast
Copy link
Owner

xxfast commented Aug 14, 2024

Looks like CI is failing

  • Since API changes. We need to run ./gradlew apiDump to update all the change signatures as we are using binary-compatibility-validator
  • A bunch of the tests in :kstore-file is failing

I will fix these in my branch ir/kotlinx-io. Stay tuned 🤞

kotlinx-serialization = "1.6.2"
okio = "3.9.0"
junit-jupiter="5.10.1"
kotlin = "2.0.20-Beta2"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mani1232 is there a reason why we can't use the latest stable?

@xxfast xxfast mentioned this pull request Aug 14, 2024
14 tasks
@xxfast
Copy link
Owner

xxfast commented Aug 14, 2024

Included in #116 and available on 0.9.0-SNAPSHOT

@xxfast xxfast closed this Aug 14, 2024
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 this pull request may close these issues.

None yet

3 participants