Giter Club home page Giter Club logo

flake-id-generators's Introduction

Welcome to Flake ID Generators Home Page Build status

Original source: http://flakeidgenerators.codeplex.com/

Flake ID Generators is a set of decentralized, k-ordered id generation services in C#.

  • FlakeGen.Id64Generator - generates 64-bit ids. The implementation is heavily derivative of Twitter's Snowflake written is Scala.
  • FlakeGen.IdGuidGenerator - generated Guid (128-bit) ids
  • FlakeGen.IdStringGeneratorWrapper - a wrapper for FlakeGen.Id64Generator returning k-ordered ids in various string formats (e.g. number, hex, base 32)

Both services generates k-ordered ids (read time-ordered lexically). Run one on each node in your infrastructure and they will generate conflict-free ids on-demand without coordination.

Features

FlakeGen.Id64Generator

  • Generator written in C#
  • Compact ids (under 64 bit) directly sortable
  • Id is composed of:
    • time - 41 bits (millisecond precision)
    • configured instance id - 10 bits - gives us up to 1024 instances
    • sequence number - 12 bits - usually 0, incremented when more than one id is requested in the same millisecond and reset to 0 when the clock ticks forward. Rolls over every 4096 per machine.
      • The generator has protection mechanism for sequence roll over in the same millisecond.

FlakeGen.IdGuidGenerator

  • Generator written in C#
  • Generated ids directly sortable
  • Id is composed of:
    • time - 64-bits - milliseconds since the epoch (Jan 1 1970)
    • configured instance id - 48 bits - it can be MAC address from a configurable device or database sequence number or any other 6 bytes identifier
    • sequence number - 16-bits - usually 0, incremented when more than one id is requested in the same millisecond and reset to 0 when the clock ticks forward. Rolls over every 65536 per machine.

flake-id-generators's People

Contributors

bforben avatar

Watchers

James Cloos avatar

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.