Re: On NSIncrementalStore UUID Uniqueness
Re: On NSIncrementalStore UUID Uniqueness
- Subject: Re: On NSIncrementalStore UUID Uniqueness
- From: Daryle Walker <email@hidden>
- Date: Sat, 14 Jan 2017 05:41:17 -0500
> On Jan 11, 2017, at 3:58 PM, Keary Suska <email@hidden> wrote:
>
>
>> On Jan 11, 2017, at 11:16 AM, Jens Alfke <email@hidden> wrote:
>>
>>
>>> On Jan 10, 2017, at 2:00 PM, Jean-Daniel <email@hidden> wrote:
>>>
>>> UUID means Universally unique identifier and it must be unique: https://en.wikipedia.org/wiki/UUID <https://en.wikipedia.org/wiki/UUID><https://en.wikipedia.org/wiki/UUID <https://en.wikipedia.org/wiki/UUID>>
>>> To generate an UUID, use a standard system function (CFUUID, NSUUID, libuuid, …)
>>
>> This is not what I believe Daryle was asking, and it’s sent everyone off on a tangent about what UUIDs are.
>>
>> My interpretation of the original question: Is an NSIncrementalStore’s UUID scoped to the specific database, or is it scoped to that _implementation_ of the store? That is, is the UUID generated at runtime or at compile time?
>>
>> I don’t know the answer; just hoping to get the discussion back on track :)
>
> The docs say:
> "A unique identifier for the store at the given URL. It must be uniquely and reproducibly derivable, such that multiple instances of your store return the same UUID”
>
> My reading is that the store UUID would be unique to a specific database since it is only unique to the URL location of the store. I thin the docs use “instance” in a strictly OOP sense.
Yes, this is what my question is about. Could I grab a UUID from a get-a-random-UUID site, hard code it as a type-level property in Swift, and use it for every instantiation (even for different files)? If this isn’t acceptable, I’m seemingly stuck since the data format doesn’t have a UUID field within it and I can’t base a UUID off of a hash of the file since it would change after each edit.
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?
—
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