Categorygithub.com/ndlib/noids
modulepackage
1.0.5
Repository: https://github.com/ndlib/noids.git
Documentation: pkg.go.dev

# README

noids

Implements a server to provide a NOID service. It can persist its state to either the file system or a mysql database. For compatibility with existing ids, the minting tries to follow how the Ruby Noid gem works.

Installation

  1. Install a Go development environment. It is easiest to use a package manager. On my Mac I use homebrew:

     brew install go
    

    Make sure the go version is >= 1.3

     go version
    

    Now set the "Go Path":

     mkdir ~/gocode
     export GOPATH=~/gocode
    
  1. Get the noid server:

     go get github.com/ndlib/noids
    
  2. Run the server:

     mkdir ~/noid_pool
     $GOPATH/bin/noids --storage ~/noid_pool
    

Using the API

Get a list of current noid counters:

$ curl http://localhost:13001/pools
[ ]

Add a new noid counter:

$ curl http://localhost:13001/pools -F name=abc -F template=.seek
{"Name":"abc","Template":".seek+0","Used":0,"Max":841,"Closed":false,"LastMint":"2013-12-03T11:37:14.271254-05:00"}

Mint some identifiers:

$ curl http://localhost:13001/pools/abc/mint -F n=11
["000","012","024","036","048","05b","06d","07g","08j","09m","0bp"]

Get noid information:

$ curl http://localhost:13001/pools/abc
{"Name":"abc","Template":".seek+11","Used":11,"Max":841,"Closed":false,"LastMint":"2013-12-03T11:40:50.657972456-05:00"}

To help sync the minter with ids which have already been minted, use the AdvancePast route. Calling this with an id will ensure that id will never be minted by this server.

$ curl http://localhost:13001/pools/abc/advancePast -F id=bb1
{"Name":"abc","Template":".seek+301","Used":301,"Max":841,"Closed":false,"LastMint":"2013-12-03T11:43:53.049369916-05:00"}

So now if we were to mint again:

$ curl -X POST http://localhost:13001/pools/abc/mint
["bc3"]

Using mysql database backend

MySql configuration can be done either using a config file or the command line. The command line option --mysql with the connection information in the format user:password@tcp(hostname:port)/database.

Security and Authentication

There is none.

Documentation

See noid-service.md.

# Packages

Implements the noid generator as specified in https://wiki.ucop.edu/display/Curation/NOID We aim to be compatible with the ruby noid generator (https://github.com/microservices/noid) In one respect, though, we are different: our random generation does not rely on a random number generator.
noid-tool a command line utility to decode and validate noids.

# Functions

No description provided by the author
No description provided by the author
Create a PoolStore which will serialize noid pools as records in a SQL database.
Create a PoolStore which will serialize noid pools as json files in a directory.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SetupHandlers adds the routes to the global http route table.
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
PoolInfo contains the public info for a pool.

# Interfaces

PoolStore provides a way to change the storage backend.
No description provided by the author