metaflake

command module
v0.0.0-...-16afd8f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2017 License: MIT Imports: 15 Imported by: 0

README

metaflake

An ID generator for snowflake nodes.

Dependency

Create Amazon DynamoDB table as following terraform configuration.

resource "aws_dynamodb_table" "metaflake_table" {
  name           = "metaflake_table"
  read_capacity  = 1
  write_capacity = 1
  hash_key       = "i"

  attribute {
    name = "i"
    type = "N"
  }

  ttl {
    attribute_name = "t"
    enabled = true
  }
}

How to use

# Run metaflake with TABLE env,
TABLE=metaflake_table metaflake &

# fetch ID,
ID=$(curl -sf http://localhost:8000/ --retry 20 --retry-connrefused --retry-delay 1)

# and use.
echo $ID

# When you want to release the ID, just kill metaflake process.
pkill metaflake

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL