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 p/uuid #2076

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open

feat: add p/uuid #2076

wants to merge 31 commits into from

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 ✅

Project coverage is 63.10%. Comparing base (af05780) to head (3a18918).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2076      +/-   ##
==========================================
- Coverage   63.32%   63.10%   -0.22%     
==========================================
  Files         548      548              
  Lines       78511    81134    +2623     
==========================================
+ Hits        49719    51203    +1484     
- Misses      25438    26511    +1073     
- Partials     3354     3420      +66     
Flag Coverage Δ
contribs/gnodev 61.11% <ø> (+0.53%) ⬆️
contribs/gnofaucet 14.82% <ø> (ø)
gno.land 67.37% <ø> (+0.18%) ⬆️
gnovm 67.88% <ø> (ø)
misc/genstd 79.72% <ø> (ø)
tm2 62.42% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@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.

Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

This is super cool, I can already see myself using it :)

I've left a few comments, otherwise it looks good 💯

examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid_test.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid_test.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid_test.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid_test.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
Co-authored-by: Morgan <git@howl.moe>
Copy link
Member

@moul moul left a comment

Choose a reason for hiding this comment

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

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?

@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

examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
@zivkovicmilos
Copy link
Member

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

examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/uuid/uuid.gno Outdated Show resolved Hide resolved
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: In Progress
Status: In Review
Development

Successfully merging this pull request may close these issues.

7 participants