Giter VIP home page Giter VIP logo

spaceflake's Issues

Bulk generation of Spaceflake IDs

Proposal

Generate lots Spaceflake IDs to, for example, feed a database or another dark reason.

There would be two ways of doing it:

  • Add a (w *Worker) BulkGenerateSpaceflakes() function
  • Add a BulkeGenerateSpaceflakes(s GeneratorSettings) function

Both can be possible of course, like the entire library

Potential Issues

Since we can only generate 4095 Spaceflakes per millisecond on a single worker there would be two options, each for the ways of doing above:

  • Sleep a millisecond after 4095 Spaceflakes have been generated
  • Automatically scale and create a new worker, or even new node

about Sponsoring

would u please setup a Sponsoring as one-time Sponsoring?

i love this repo, thanks a lot for great works.

Generate Spaceflake at time

Proposal

Be able to generate a Spaceflake where the base or timestamp of that Spaceflake can be customized. The argument would be of type Time and can be created with time.Date. It would contain two generators, one on a Worker type and another one with GeneratorSettings added as argument.

When using a worker

func (w *Worker) GenerateSpaceflakeAt(at time.Time) (*Spaceflake, error) {
    // ...
}

Without using a worker

func GenerateAt(s GeneratorSettings, at time.Time) (*Spaceflake, error) {
    // ...
}

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.