Following up on my question: Unique Linux filename, sortable by time
I need to generate a UUID that is itself alpha-numerically sequential over time. I assume I'll need to append the system date seconds since epoch and nanoseconds. This means I really just need an UUID algorithm that is alpha-numerically sequential within a given nanosecond.
So for example, I'm thinking of uuid's something like:
SECONDS_SINCE_EPOCH.NANOSECONDS.UID
The following bash:
for i in `seq 1 10`;
do
echo `date '+%s.%N'`.`uuidgen -t`
done
Results in:
1424718695.481439000.c8fef5d4-bb8f-11e4-92c7-00215e673861
1424718695.484130000.c8ff5eb6-bb8f-11e4-ae12-00215e673861
1424718695.486718000.c8ffc2ca-bb8f-11e4-ae15-00215e673861
1424718695.489267000.c90025bc-bb8f-11e4-a624-00215e673861
1424718695.491803000.c90089f8-bb8f-11e4-95ac-00215e673861
1424718695.494381000.c900ed76-bb8f-11e4-9058-00215e673861
1424718695.496899000.c901513a-bb8f-11e4-8018-00215e673861
1424718695.499460000.c901b440-bb8f-11e4-b382-00215e673861
1424718695.502007000.c90217a0-bb8f-11e4-89cd-00215e673861
1424718695.504532000.c90279d4-bb8f-11e4-b515-00215e673861
These files names appear as though they would suffice... but my fear is that I can't promise the names will be alpha-numerically sequential IF two files are created within the same nano-second (think large scale enterprise system with 10's of cores running many concurrent users). Because at that point I'm relying solely on the UUID algorithm for my unique name and all the UUID algorithm promises is uniqueness, not "alpha-numeric-sequential-ness".
Any ideas for a method that can guarantee uniqueness AND alpha-numeric sequential order? Because we're dealing with large enterprise systems, I need to keep my requirements as old-school as possible but I can probably swing some older versions of Python and whatnot if a solution in pure bash isn't readily available.