lshift/diffa — pull request #279 by anthonyls (2012-12-07 12:02:31+00:00)
Title: Machine ID generator to be used by The ID generator (snowflake)

As an Application Developer
I want to create machine-specific ID generators
so that records are unique across all nodes in a cluster.

Scope

* unique assignment of a 10-bit machine identifier to each client
* performance

Acceptance Criteria

* Given that many identifiers are already assigned, when I request an identifier, I expect not to receive one if 30 consecutive attempts to acquire an identifier fail
* Given that there are few (< 20) identifiers currently assigned, when I request an identifier, I should receive one within 1 second
* Given that an identifier, m, has been previously assigned, but is now unassigned, when I request identifier m, it should be assigned to me
* Given that there are currently zero identifiers assigned, I should be able to assign 20 identifiers within 5 seconds.
* Given that an identifier is currently assigned, when I request that identifier, it should not be assigned to me.

Note: I/Me in the above is the client of the machine identifier generator.