Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Repository files navigation

Local Snowflakes

A local implementation of Snowflake generation in Java.

Licensed under the Apache 2.0 License.

Notice

This library is now discontinued, use Nanoflakes Java implementation now.

Installation

Latest Version

Using in Gradle:

repositories {
  jcenter()
}

dependencies {
  compile 'net.notjustanna.libs:snowflake-local:LATEST' // replace LATEST with the version above
}

Using in Maven:

<repositories>
  <repository>
    <id>central</id>
    <name>bintray</name>
    <url>http://jcenter.bintray.com</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>net.notjustanna.libs</groupId>
    <artifactId>snowflake-local</artifactId>
    <version>LATEST</version> <!-- replace LATEST with the version above -->
  </dependency>
</dependencies>

Usage

Use LocalGenerator or LocalGeneratorBuilder to create the local generators.

SnowflakeGenerator generator = new LocalGeneratorBuilder()
    .epoch(1420070400000L)
    .build();

Then use the SnowflakeGenerator to generate IDs.

long id = generator.getDatacenter(3L).getWorker(0L).generate();

Support

About

Snowflake Implementation for Local generation of IDs

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages