• 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: On NSIncrementalStore UUID Uniqueness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: On NSIncrementalStore UUID Uniqueness


  • Subject: Re: On NSIncrementalStore UUID Uniqueness
  • From: Daryle Walker <email@hidden>
  • Date: Thu, 19 Jan 2017 16:14:29 -0500

> On Jan 16, 2017, at 3:59 AM, Alastair Houghton <email@hidden> wrote:
>
> On 14 Jan 2017, at 10:41, Daryle Walker <email@hidden> wrote:
>>
>> Could I base the UUID off a hash of the URL? Maybe, but it wouldn’t survive file moves. There are file references in macOS, which would be more stable, but I read that there’s a bug in the URL class where it would degrade file-reference URLs to standard-file URLs, so that’ll be problematic. Another solution would to create bookmark data from a file URL and take a hash of that. But are multiple bookmark data blocks of the same file URL consistent enough for this idea to work?
>
> FYI, you can base a UUID off any identifier you please, so if you have *any* stable identifier, you can use that.  The way you do so is:
>
> 1. Generate a UUID for your namespace, if there isn’t a standard one.  (Standard ones exist for domain names, URLs, OIDs and X.500 DNs.  Otherwise just generate a version 1 or 4 UUID, as appropriate.)
>
> 2. Use that and your identifier to compute an SHA-1 hash.
>
> 3. Use the SHA-1 hash to generate a version 5 UUID.

I looked at NSIncrementalStore subclasses on GitHub for inspiration. (Couldn’t find any NSAtomicStore ones.) While in theory we should take at least semi-heroic measures, in practice everyone goes “screw it” and calls the random UUID function (from NSProcessInfo). One guy even hard-coded a “1” as the UUID!

—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >On NSIncrementalStore UUID Uniqueness (From: Daryle Walker <email@hidden>)
 >Re: On NSIncrementalStore UUID Uniqueness (From: Jean-Daniel <email@hidden>)
 >Re: On NSIncrementalStore UUID Uniqueness (From: Jens Alfke <email@hidden>)
 >Re: On NSIncrementalStore UUID Uniqueness (From: Keary Suska <email@hidden>)
 >Re: On NSIncrementalStore UUID Uniqueness (From: Daryle Walker <email@hidden>)
 >Re: On NSIncrementalStore UUID Uniqueness (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: Purge all remnants of an old incarnation of my app
  • Next by Date: Re: On NSIncrementalStore UUID Uniqueness
  • Previous by thread: Re: On NSIncrementalStore UUID Uniqueness
  • Next by thread: Re: On NSIncrementalStore UUID Uniqueness
  • Index(es):
    • Date
    • Thread