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

eventsByTag and currentEventsByTag to use Offset #21615

Merged
merged 4 commits into from
Oct 17, 2016
Merged

eventsByTag and currentEventsByTag to use Offset #21615

merged 4 commits into from
Oct 17, 2016

Conversation

richardimaoka
Copy link
Contributor

Refs #21283

As discussed in the above issue, I didn't implement other offset than long (Sequence) for LevelDB journal.

I did my best for javadsl.Offset and scaladsl.Offset, but not sure if that's the correct way... please let me know if I should do them differently.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed validating PR is currently being validated by Jenkins labels Oct 3, 2016
@akka-ci
Copy link

akka-ci commented Oct 3, 2016

Test FAILed.

@richardimaoka
Copy link
Contributor Author

Will look into test failure

@akka-ci akka-ci added validating PR is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) labels Oct 4, 2016
@akka-ci
Copy link

akka-ci commented Oct 4, 2016

Test FAILed.

@akka-ci akka-ci removed the validating PR is currently being validated by Jenkins label Oct 4, 2016
@richardimaoka
Copy link
Contributor Author

As it is an experimental module, do we keep the binary compatibility? If we do, let me fix my code.

error akka-persistence-query-experimental: Binary compatibility check failed!

@@ -17,7 +17,7 @@ trait CurrentEventsByTagQuery extends ReadJournal {
* is completed immediately when it reaches the end of the "result set". Events that are
* stored after the query is completed are not included in the event stream.
*/
def currentEventsByTag(tag: String, offset: Long): Source[EventEnvelope, NotUsed]
def currentEventsByTag(tag: String, offset: Offset): Source[EventEnvelope, NotUsed]
Copy link
Member

Choose a reason for hiding this comment

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

One topic for discussion is how we shall introduce this change without breaking plugins.
We can change the API, since persistence-qurey is experimental, but I think it can cause unnecessary trouble to do that in a 2.4.x. When we release Akka 2.5 we can change the API before removing the experimental label.

One way would be to add CurrentEventsByTagQuery2 with the new signatures. Then in 2.5 we make that the only trait (and rename it to CurrentEventsByTagQuery).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, added EventsByTagQuery2 and CurrentEventsByTagQuery2.


trait Offset {
def hashCode: Int
def asScala: akka.persistence.query.scaladsl.Offset
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need different classes for scaladsl and javadsl. We can place it in akka.persistence.query package.

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 I moved the javadsl and scaladsl offset to akka.persistence.query and combined them into one.

throw new IllegalArgumentException("UUID " + value + " is not a time-based UUID")
}

override def hashCode: Int = value.hashCode
Copy link
Member

Choose a reason for hiding this comment

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

equals also

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Offset classes are case classes, so I think equals method implementation is already given?

@akka-ci akka-ci added validating PR is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) validating PR is currently being validated by Jenkins labels Oct 8, 2016
@akka-ci
Copy link

akka-ci commented Oct 8, 2016

Test PASSed.

@richardimaoka
Copy link
Contributor Author

@patriknw thanks for the review - I updated this following your comments. Could you let me know if it looks ok now?

import java.util.UUID

trait Offset {
def hashCode: Int
Copy link
Member

Choose a reason for hiding this comment

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

why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I didn't realize case classes implement hasCode automatically. So I removed it in the new commit.


override def hashCode: Int = value.hashCode

override def toString: String = value.toString
Copy link
Member

Choose a reason for hiding this comment

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

why override hashCode and toString? isn't the case class enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that makes more sense. I didn't realize hasCode was provided by case class, and it looks case class's toString is better than what I did - removed them in the new commit.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed tested PR that was successfully built and tested by Jenkins labels Oct 9, 2016
@akka-ci
Copy link

akka-ci commented Oct 9, 2016

Test PASSed.

@akka-ci akka-ci removed the validating PR is currently being validated by Jenkins label Oct 9, 2016
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

@patriknw
Copy link
Member

@johanandren please review, so that we have 2 lgtm

@patriknw patriknw merged commit 375c032 into akka:master Oct 17, 2016
@patriknw
Copy link
Member

thanks @richard-imaoka

ktoso pushed a commit to ktoso/akka that referenced this pull request Oct 19, 2016
* EventsByTagQuery2 and CurrentEventsByTagQuery2 to keep binary compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tested PR that was successfully built and tested by Jenkins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants