[aerogear-dev] UUID Generation
kris at redhat.com
Tue Sep 11 16:39:37 EDT 2012
On Sep 11, 2012, at 3:33 PM, Douglas Campos <qmx at qmx.me> wrote:
> On Sep 11, 2012, at 5:20 PM, Kris Borchers wrote:
>> Hey everyone, I just wanted to let you know I have been doing a little research around generating id's on the client side. I have found a little JS utility lib that I am thinking about using that generates RFC4122 compliant UUIDs.
>> That library is here http://www.broofa.com/Tools/Math.uuid.js if you are interested. Bruno thought it would be a good idea that I send this out for everyone as it may be a good idea to see what is available in the Android and iOS world in terms of generating similar id's.
>> I have been thinking about this a bit lately and am also hoping to get people's thoughts on whether or not this may be overkill.
> It's not overkill at all, it's standard practice when you don't have 100% server uptime (which is easily to see over a 3G connection)
>> The reason I say that is that really the only reason you would need such a unique id is if there will be a chance of something else (another client, server, etc.) generating an id for a piece of data that would conflict with this one. What I was thinking though is that is only an issue at sync time. As long as you know the id is unique in the client, and the status of that piece of data (new, modified, removed), then at sync time, you can rectify those id's that are out of sync with what is generated at the server and you have one point of id generation.
> Using UUID's will save us a lot of headaches on the long run - even having sync statuses for our data
I guess I am just not sure what a UUID gets us that epoch time doesn't. If I assign an id based on epoch time in milliseconds, that will be unique client side. Then when I sync, I can change that id to what ever the server is using, which may not be a UUID, it could just be in integer in which case trying to assign an id server side based on a UUID generated client side would fail. Maybe I'm missing some point though.
>> Would really appreciate others' thoughts on this.
>> aerogear-dev mailing list
>> aerogear-dev at lists.jboss.org
> -- qmx
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
More information about the aerogear-dev