Coder Social home page Coder Social logo

Sequence input for CreateId() about idgen HOT 3 CLOSED

robthree avatar robthree commented on July 19, 2024
Sequence input for CreateId()

from idgen.

Comments (3)

RobThree avatar RobThree commented on July 19, 2024

That's currently not supported and I don't see how this should be implemented in a generic way without sacrificing a lot of performance. You'd need to have an IGeneratorProvider which would return the 'shard' or 'generator' which would have to take some arbitrary value as input to be able to do it's work and then you'd also need an ISequenceProvider which would need a similar arbitrary input. That would, in turn, mean that CreateId() would need to be able to take some argument(s) etc.

Suggestions are welcome, but I don't see how this would be implemented without a major rewrite and/or breaking backcompat.

Also: since you're specifically asking for sequence: adding a modulo <value> essentially means "wrap around" which would result in collisions...

from idgen.

boraturant avatar boraturant commented on July 19, 2024

maybe something like simple CreateIdWithSequenceInput(long sequence) - without changing the CreateId() - however, I guess lenght has to be checked with sequence input and mask capacity for sequence. Regarding the modulo, I guess it should be the callers responsibility inputing the modulo-ed sequence value.

thank you for your feedback!

from idgen.

RobThree avatar RobThree commented on July 19, 2024

Regarding the modulo, I guess it should be the callers responsibility inputing the modulo-ed sequence value.

Isn't it easier, at that point, to implement your "own IdGen"? It isn't exactly rocket surgery, as you can see in the instagram post.

from idgen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.