Human and url friendly (e)xtensible (d)istributed (id)s
Generate unique ids based on current UTC time in milliseconds, shard number and loopback counter. Shard number can be automatically calculated from a parent of the object (owner id, scope, blog id). It allows to group objects related to same parent in same shard.
Parts of id are encoded using Bitcoin's variant of base58. It's both human and url friendly. Bitcoin variant of base58 is chosen because encoded numbers can be properly sorted. It's guaranteed that if A > B then base58(A) > base58(B) for string of same length. It's not true for Flickr's variant of base58 or base64 and base62.
Our approach have a lot in common with Sharding & IDs at Instagram but date range for our ids isn't limited to 41 years. In default setup our ids can be represented as 64-bits integers during 146 years. However our main advantage is extensibility. After 41 years Instagram's numeric ids will stop to work and you will need to migrate to new format, but our string ids will continue to work even when 146 years have elapsed (new ids will not fit into 64-bit data range however).
Instagram's IDs are generated on database level using PostgreSQL server functions to maintain generators state. EDID can generate IDs on client or app server as well.
Copyright (C) 2015 Dmytro V. Dogadailo
This program is free software; you can redistribute it and/or modify it under the terms of the MIT License.