Re: Deterministic UUID?
"Justin T. Sampson" <[email protected]>
| Newsgroups | gmane.comp.java.prevayler |
|---|---|
| Message-ID | <[email protected]> |
Hi Karl, My first thought was, naturally, passing the host identifier in as part of each transaction. You could also store the host identifier somewhere inside your prevalent system, and execute a transaction to set it when the app starts up. If you know which transactions will need UUIDs (and how many), you could create the UUIDs themselves at transaction-creation time. This is probably closest to what I'd do most often. Another idea might be to have a pool of precreated but unassigned UUIDs inside the prevalent system, and have a transaction that adds a batch of new UUIDs to the pool. The UUIDs would be created by whatever nondeterministic means you like, outside of the prevalent system. Whenever you need a new UUID inside some other transaction, just remove the next one from the pool. Yet another idea, rather more hardcore, would be to store a strong pseudorandom number generator in your prevalent system, seed it with high-entropy random data with a transaction at app startup, and produce random UUIDs (which don't need host identifiers) rather than time-based UUIDs. Cheers, Justin On Mon, Jan 11, 2010 at 12:43 AM, Karl Wettin <[email protected]> wrote: > Due to several reasons I like my UUIDs, but as they are non > deterministic they cause a problem for Prevayler. > > So based on execution time and a sequence number I implemented this 10 > byte identity I call DUID, deterministic unique identifier. To get all > the features of an UUID in there (except for the universal part) it > would be nice to add the final 6 bytes of host identification in there > too. I suppose that would mean an application and cluster node > identitity. Is there something existing in the Prevayler API that I > can use for this? The only deterministic solution I can think of is to > implement a transaction superclass that contains these values, > automatically initialized via some config file/spring/what not. > > > karl > > ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion _______________________________________________ "Databases in Memoriam" -- http://www.prevayler.org