Skip to content

feat: add p/snowflake #2076

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

Merged
merged 36 commits into from
Apr 7, 2025
Merged

feat: add p/snowflake #2076

merged 36 commits into from
Apr 7, 2025

Conversation

DIGIX666
Copy link
Contributor

I suggest adding a UUID package because I think it could be useful to have it available. I think it can further facilitate traceability and compatibility between different systems and apps as they would have a common standard for identifying entities.

To improve UUID generation, I wanted to add a resolver like Snowflake, but from what I've searched, sync/atomic is not supported on Gno. Is there another similar package that I might have missed ?

@DIGIX666 DIGIX666 requested review from a team as code owners May 12, 2024 15:39
@DIGIX666 DIGIX666 requested review from harry-hov and piux2 and removed request for a team May 12, 2024 15:39
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label May 12, 2024
Copy link

codecov bot commented May 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@DIGIX666 DIGIX666 changed the title feat: initial p/uuid dapp feat: add p/uuid May 12, 2024
@notJoon
Copy link
Member

notJoon commented May 13, 2024

To improve UUID generation, I wanted to add a resolver like Snowflake, but from what I've searched, sync/atomic is not supported on Gno. Is there another similar package that I might have missed ?

There is no other way to guarantee atomicity besides using time in environments where atomic is not supported. If we consider it further, it seems possible to generate a random value (using crypto/rand or not merged yet, but maybe later) like a machine ID, assign it, and then combine it. Of course, this is slightly different from the implementation of Snowflake.

@DIGIX666
Copy link
Contributor Author

To improve UUID generation, I wanted to add a resolver like Snowflake, but from what I've searched, sync/atomic is not supported on Gno. Is there another similar package that I might have missed ?

There is no other way to guarantee atomicity besides using time in environments where atomic is not supported. If we consider it further, it seems possible to generate a random value (using crypto/rand or not merged yet, but #1933 later) like a machine ID, assign it, and then combine it. Of course, this is slightly different from the implementation of Snowflake.

Thanks for your explanation. I will check the progress of crypto/rand to try to use it.

@DIGIX666
Copy link
Contributor Author

seems not "gno-ified" enough :)

can you also provide some examples, like a screenshot or something so that we can see various generated output examples just by reviewing the PR, please?

Output this my last commit 485ce8d:
SCR-20240917-txql

Copy link
Contributor Author

@DIGIX666 DIGIX666 left a comment

Choose a reason for hiding this comment

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

Finish corrective review

@zivkovicmilos
Copy link
Member

Hey @DIGIX666, can you please update this branch with master? 🙏

@Gno2D2
Copy link
Collaborator

Gno2D2 commented Apr 3, 2025

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
  • The pull request description provides enough details (checked by @thehowl)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)
🟢 Pending initial approval by a review team member, or review from tech-staff

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 The pull request was created from a fork (head branch repo: DIGIX666/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Pending initial approval by a review team member, or review from tech-staff

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 Not (🔴 Pull request author is a member of the team: tech-staff)

Then

🟢 Requirement satisfied
└── 🟢 If
    ├── 🟢 Condition
    │   └── 🟢 Or
    │       ├── 🟢 At least 1 user(s) of the organization reviewed the pull request (with state "APPROVED")
    │       ├── 🟢 At least 1 user(s) of the team tech-staff reviewed pull request
    │       └── 🔴 This pull request is a draft
    └── 🟢 Then
        └── 🟢 Not (🔴 This label is applied to pull request: review/triage-pending)

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission
The pull request description provides enough details

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 Not (🔴 Pull request author is a member of the team: core-contributors)
    └── 🟢 Not (🔴 Pull request author is user: dependabot[bot])

Can be checked by

  • team core-contributors

@DIGIX666 DIGIX666 changed the title feat: add p/uuid feat: add p/snowflake Apr 4, 2025
@thehowl thehowl merged commit 02fca69 into gnolang:master Apr 7, 2025
66 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in 💪 Bounties & Worx Apr 7, 2025
@github-project-automation github-project-automation bot moved this from In Review to Done in 🧙‍♂️gno.land core team Apr 7, 2025
stefann-01 pushed a commit to stefann-01/gno that referenced this pull request Jul 14, 2025
I suggest adding a `UUID` package because I think it could be useful to
have it available. I think it can further facilitate traceability and
compatibility between different systems and apps as they would have a
common standard for identifying entities.

To improve `UUID` generation, I wanted to add a resolver like
`Snowflake`, but from what I've searched, `sync/atomic` is not supported
on Gno. Is there another similar package that I might have missed ?

---------

Co-authored-by: théo dub <theodub@MacThox.local>
Co-authored-by: Morgan <morgan@morganbaz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related 🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

9 participants