SleepyMode / Snowflake

C++ Implementation of Twitter's Snowflake algorithm.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Snowflake

C++ header-only Implementation of Twitter's Snowflake algorithm.

Terminology

  • Instances are referred to as "Machine Identifiers" (.machineId)
  • Sequences are referred to as "Worker Identifiers" (.workerId)

Usage

Sample usage can be found in test.cc. Make sure to initialize the library with SnowflakeId::initialize prior to using (w/ epoch and machine identifier).

Example:

int main(int argc, char* argv[], char* envp[])
{
	SnowflakeId::initialize(0, 50);
	SnowflakeId identifier = SnowflakeId::generate();
	std::cout << identifier.implode() << std::endl;
}

About

C++ Implementation of Twitter's Snowflake algorithm.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C++ 100.0%