• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Globally unique IDs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Globally unique IDs


  • Subject: Re: Globally unique IDs
  • From: Alexander Spohr <email@hidden>
  • Date: Sun, 8 Feb 2004 12:40:49 +0100

Am 08.02.2004 um 02:11 schrieb Pierre Frisch:
On Feb 7, 2004, at 14:46, Ben Trumbull wrote:
At 13:45 -0500 2/6/04, Colin O'Brien wrote:
It seems the automatic private key mechanism in WO only provides
unique keys
within a single database.

Yes and no. EOF can only support an Entity mapping to a single database at a time. So the Table+rowPK is unique within a scope beyond a single database (all apps using that Entity's model; glossing over entity inheritance).

ben,
this is wrong. eof can generate a globally unique pk, which has nothing to do with the table name or the entity.


It's not uncommon practice to manipulate the models, connection
dictionaries, model groups, and EOF stacks (EOObjectStoreCoordinators)
at runtime.  So, indeed, it's not difficult to create a situation
where the PKs are no longer unique with multiple databases even within
one app.

we discuss _globaly_unique_ pks here, not 32-bit pks. so you might meddle as much as you like with all you said and the pk will still be unique.


Could you elaborate on the uniqueness. If I am not mistaken the 24
bytes is build as follow:

_hostAddress = "";				// 12 Char
_processIdentifier = "00000000";		// 8  Char
_counter = 0;				// 4 Char
_timestamp = (new Date()).getTime();	// 16 Char
_random = new Random(_timestamp);		// 8 Char

The timestamp is defined as milliseconds I do not see how you could get
two objects with the same ID.

pierre, 12+8+4+16+8 = 38, not 24 :)

i am finding two different sizes for that globally unique key:
12 byte and 24 byte. did apple change that sometime? what is the current state?


12 byte examples:
http://developer.apple.com/documentation/LegacyTechnologies/WebObjects/ WebObjects_4.0/System/Documentation/Developer/WebObjects/Topics/ GenPrimaryKeys.html
http://developer.apple.com/documentation/LegacyTechnologies/WebObjects/ WebObjects_4.0/System/Documentation/Developer/EnterpriseObjects/Guide/ EOFDevGuide.pdf


24 byte example:
http://developer.apple.com/documentation/WebObjects/Enterprise_Objects/ Saving/chapter_8_section_7.html#//apple_ref/doc/uid/DontLinkBookID_498- DontLinkChapterID_14-BADIFDCI



but let's have a look at EOTemporaryGlobalID:

public EOTemporaryGlobalID()
Creates and returns an EOTemporaryGlobalID as a unique instance. The returned object contains a byte string that's guaranteed to be unique network wide. As a result, EOTemporaryGlobalIDs can be safely passed between processes and machines while still preserving global uniqueness. The returned byte string has the format:


 < Sequence [2], ProcessID [2] , Time [4], IP Addr [4] >

so 2 + 2 + 4 + 4 = 12 byte, right?
but maybe it is 2 byte per character (because of unicode)?
but the description says "byte string".

hey apple eof-team! do we need 12 or 24 bytes?

i am really beginning to think about changing my databases to those uniques... the thought of worldwide unique keys is intriguing!

	atze

ps. sure, i could just try and set up a database. but it would be nice to have the docs in order, wouldn't it?
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Globally unique IDs
      • From: Ben Trumbull <email@hidden>
    • Re: Globally unique IDs
      • From: Alexander Spohr <email@hidden>
References: 
 >Globally unique IDs (From: "Colin O'Brien" <email@hidden>)
 >Re: Globally unique IDs (From: Ben Trumbull <email@hidden>)
 >Re: Globally unique IDs (From: Pierre Frisch <email@hidden>)

  • Prev by Date: Re: Globally unique IDs
  • Next by Date: Re: Globally unique IDs
  • Previous by thread: Re: Globally unique IDs
  • Next by thread: Re: Globally unique IDs
  • Index(es):
    • Date
    • Thread