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

Implement SnapshotValueReader #4

Merged
merged 16 commits into from
Aug 23, 2023
Merged

Implement SnapshotValueReader #4

merged 16 commits into from
Aug 23, 2023

Conversation

nedtwigg
Copy link
Member

@nedtwigg nedtwigg commented Aug 11, 2023

Implementing SnapshotValueReader is the first step. One key trick:

  • We are using Kotlin Multiplatform, and unfortunately we are currently hitting a known bug which requires us to use the alpha-quality K2 compiler.
  • If gradlew test is failing, try a gradlew clean then try again. This is because of K2.

@jknack
Copy link
Collaborator

jknack commented Aug 18, 2023

@nedtwigg should I merge this? or work in the feature branch?

@nedtwigg
Copy link
Member Author

Work in this feature branch

- Use a `line` as buffer for doing peek
- Uncomment tests
@jknack
Copy link
Collaborator

jknack commented Aug 21, 2023

@nedtwigg here is. I took me a bit I have to learn/read a bit about KMM and also struggling with IDEA to run tests.

Make LineReader.readLine nullable to follow the JVM version.

@nedtwigg
Copy link
Member Author

Looks great at first glance! I'll take a look later tonight and then point you at the next task on this project.

@nedtwigg
Copy link
Member Author

@jknack an excellent start! I did a few things in the commits above:

  • I refactored ArrayMap a bit so we can disable the experimental K2 parser, IDE tests should now be reliable
  • I fixed some things
  • I broke some things on purpose

My advice is:

  • Look quickly at each commit I pushed above, one by one
  • Implement the functionality needed for skipValues to pass, don't worry if some of the other tests break
  • Then fix the other tests

@jknack
Copy link
Collaborator

jknack commented Aug 22, 2023

@nedtwigg pushed a new commit. I left one question about body escape

- fix failing tests
- refactor scanValue lookup
- implement skipValues
- make sure spaces/lines are keep
- TODO: unclear the body escape function
@nedtwigg
Copy link
Member Author

Excellent, you did the hard part, I think the commit above explains the tiny bit leftover. The purpose of the weird escape stuff is just:

  • literally anything can be a "name" (no dissallowed characters)
  • literally anything can be a "value" (no dissallowed characters)
  • names and values will always round-trip perfectly with no confusion or changes (except we don't preserve \r\n vs \n)
  • the snapshot files look human readable and have as little escaping as possible, but some is needed to ensure the points above

This PR is done now. I am going to:

  • open and then merge a PR which does some renaming / refactoring
  • open a new PR for you to implement for the next step

I will complete this later this evening.

@nedtwigg nedtwigg merged commit d92efc9 into main Aug 23, 2023
6 checks passed
@nedtwigg nedtwigg deleted the feat/snapshot-value-reader branch August 23, 2023 05:38
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

2 participants