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

feat: add timestamp offset by slice for persistence queries #32479

Merged
merged 2 commits into from
Aug 18, 2024

Conversation

pvlugter
Copy link
Contributor

For persistence stores that have separate queries per slice.

Copy link
Member

@patriknw patriknw left a comment

Choose a reason for hiding this comment

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

looking good

* @param offsets
* Map of TimestampOffset by slice
*/
final class TimestampOffsetBySlice private (val offsets: Map[Int, TimestampOffset]) extends Offset {
Copy link
Member

Choose a reason for hiding this comment

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

add serialization of it to QuerySerialization

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. Should only be used on init I guess, not in envelopes, but makes sense to have coverage. So that's a string-based serialization format? I'll take a look. Maybe double the timestamp offset separator with ;;.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added serialization. Uses ;; for separator between entries, and ; between each slice and its encoded timestamp offset.

val str = new java.lang.StringBuilder
if (offsetBySlice.offsets.nonEmpty) {
var first = true
offsetBySlice.offsets.foreach {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seen map in timestamp offset is sorted by pid first. Could do something similar here, and sort by slice if it's useful to have it in stable order.

Copy link
Member

@patriknw patriknw left a comment

Choose a reason for hiding this comment

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

LGTM

@pvlugter pvlugter merged commit 2d9b6c3 into akka:main Aug 18, 2024
5 checks passed
@pvlugter pvlugter deleted the timestamp-offset-by-slice branch August 18, 2024 22:55
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.

2 participants