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

Elixir Implementation #23

Merged
merged 35 commits into from
Feb 22, 2024
Merged

Elixir Implementation #23

merged 35 commits into from
Feb 22, 2024

Conversation

ArtieFuzzz
Copy link
Contributor

@ArtieFuzzz ArtieFuzzz commented Feb 16, 2024

I haven't yet published this package on hex.pm, I want to make sure everything's right before I do.

TODO:

  • Write documentation for functions
  • Add test workflow

@ArtieFuzzz
Copy link
Contributor Author

ArtieFuzzz commented Feb 17, 2024

Finished everything in the TODO list!

Other stuff I did:

  • Added benchmarks between Pika.gen/1 and Pika.Snowflake.generate/0
  • Refactored code

Something I've realized now:
- You're unable to pass a custom timestamp to Pika.Snowflake.generate

Found out that some generated snowflakes aren't integers, they're instead strings
@ArtieFuzzz
Copy link
Contributor Author

If there are any tests I should add, please mention it.

impl/ex/lib/snowflake.ex Outdated Show resolved Hide resolved
impl/ex/lib/pika.ex Outdated Show resolved Hide resolved
Copy link
Owner

@Phineas Phineas left a comment

Choose a reason for hiding this comment

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

Unfortunately, the Pika.Utils.get_mac_address/0 fails on my Mac because :hwaddr doesn't exist on some interfaces, e.g: {~c"stf0", [flags: []]}, which causes the first list element to be nil and errors out the map_join.

impl/ex/lib/snowflake.ex Outdated Show resolved Hide resolved
.github/workflows/pr-ex-test.yml Outdated Show resolved Hide resolved
@ArtieFuzzz
Copy link
Contributor Author

ArtieFuzzz commented Feb 21, 2024

Ah, on my Windows machine it worked, I'll have to find a work around to get Pika.Utils.get_mac_address/0 to work on Mac. (I'll have no way of testing this other than using GitHub Actions)

Copy link
Owner

@Phineas Phineas left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you for the PR, this will be very useful.

Also, please make sure to push the most recent changes to hex.pm!

@Phineas Phineas merged commit a06012d into Phineas:main Feb 22, 2024
4 checks passed
@ArtieFuzzz
Copy link
Contributor Author

I've published the changes under version 0.1.3

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