Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: How to generate a UUID?

From: greggirwin:mindspring at: 17-Jan-2002 22:42

Hi Sunanda, << Nice analysis! Which bounces us (if I'm following right) right back to the original question. >> Ex-actly. :) Good thoughts on the elements needed to assemble a UID. My preference would be not to require an external server if it can be avoided. I think a standalone machine needs to be able to generate UIDs as well. What you call PREFIX, I would probably call "Creation Location". To me, this equates to the unique machine identifier as used in the OSF DCE spec. There could be varying implementations for this, one of which *could* be an external server. If RT could provide a native 'machine-uid function, that would be ideal. Otherwise we have to synthesize it somehow, or make it a configuration option. The SERIAL part should be easy enough, though I see this just as a counter combined with a timestamp, which you may not given your experience. The biggest risk I see would be two instances of the script running at the same time and each being called inside the resolution of what now/precise gives us. If that's a risk worth considering, you could use a file as your shared memory space, though that wouldn't be my first choice. Clock resets also have to be considered. I like having a timestamp segment because it can be useful information in and of itself. This leaves the RANDOM part. You could let the application provide this (e.g. the make-uid function has a /with <random-segment-seed> refinement) to make it easy, and maybe just have a very simple implementation (using random/seed + random/secure) beyond that. --Gregg