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

Added TimeBasedUuid offset #5995

Merged
merged 1 commit into from
Jun 25, 2022
Merged

Conversation

ismaelhamed
Copy link
Member

@ismaelhamed ismaelhamed commented Jun 11, 2022

Changes

Adds TimeBasedUuid offset used in Cassandra.

Sadly, there's no built-in support for time-based guids in .NET. The CSharp cassandra driver has a struct (TimeUuid) compatible with v1 of java.utils.uuid. And since we can't have a reference to the cassandra driver in the Core, this implementation of the TimeBasedUuid takes a Guid instead. But then there's no way to check whether the Guid passed to TimeBasedUuid is actually a TimeUuid.

TimeUuid code has been pulled into the Tests to enable proper testing.

Feedback?

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

@Aaronontheweb
Copy link
Member

Let me know when it's ready for review - is this for Cassandra only or it intended for other Akka.Persistence journals as well?

/// Represents a v1 uuid
/// </summary>
internal struct TimeUuid : IEquatable<TimeUuid>, IComparable<TimeUuid>
{
Copy link
Member Author

Choose a reason for hiding this comment

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

TimeUuid implementation has been pulled into the code to enable proper testing.

@ismaelhamed
Copy link
Member Author

Let me know when it's ready for review - is this for Cassandra only or it intended for other Akka.Persistence journals as well?

@Aaronontheweb this approach is done. I'm looking for feedback to either wrap up this PR to be merged or look for alternatives.

@Aaronontheweb
Copy link
Member

@ismaelhamed I think the one thing I was looking for was some input from @to11mtm since he's implemented something very similar in Linq2Db. Other than that, I'll give this a review early next week and try to get it staged in our first 1.5 beta release.

@to11mtm
Copy link
Member

to11mtm commented Jun 24, 2022

@ismaelhamed I think the one thing I was looking for was some input from @to11mtm since he's implemented something very similar in Linq2Db. Other than that, I'll give this a review early next week and try to get it staged in our first 1.5 beta release.

@Aaronontheweb probably better to use this for consistency.

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

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

LGTM

public class OffsetSpec
{
[Fact]
public void TimeBasedUuid_offset_must_be_ordered_correctly()
Copy link
Member

Choose a reason for hiding this comment

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

LGTM

@Aaronontheweb
Copy link
Member

@ismaelhamed this looks good to me - you ready for me to merge it?

@ismaelhamed ismaelhamed changed the title [WIP] Added TimeBasedUuid offset Added TimeBasedUuid offset Jun 25, 2022
@ismaelhamed ismaelhamed marked this pull request as ready for review June 25, 2022 08:05
@ismaelhamed
Copy link
Member Author

@Aaronontheweb, it's ready.

@Aaronontheweb Aaronontheweb merged commit 7da2aa7 into akkadotnet:dev Jun 25, 2022
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.

3 participants