Mailing List webobjects-dev@wocommunity.org Message #199
From: OCsite <webobjects-dev@wocommunity.org>
Subject: merging changes upon a save: what are “locally uncommitted changes”, too many snapshots?
Date: Wed, 16 Jun 2021 21:23:48 +0200
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>, <webobjects-dev@lists.apple.com>
Hi there,

is the process of merging changes upon a save into other ECs, and all the kinds of snapshots available, documented somewhere in detail?

My old EOEditingContextConcepts says just this:

... However, locally uncommitted changes to objects in the EOEditingContext are by default reapplied to the objects, in effect preserving the uncommitted changes in the object graph. After the update, the uncommitted changes remain uncommitted, but the committed snapshots have been updated to reflect the values in the EOObjectStore.

and I can't see what does it actually mean “locally uncommitted changes” here. Most probably a difference from some snapshot, but I admit I am sort of lost in the things.

So far I lived in impression that (if we ignore undo) there's only one kind of snapshots: OSC-level shared snapshots of what-was-just-saved-into-DB.

I've tried to research the thing a bit and there seem to be at the very least the following snapshots:

(i) EC.committedSnapshotForObject
(ii) EC.currentEventSnapshotForObject
(iii) EODatabaseContext.snapshotForGlobalID
(iv) EODatabaseContext.localSnapshotForGlobalID

I regret to say the standard documentation does not help much. I did some testing and it looks like

- (iii) is the one snapshot I knew: whenever save finishes, it always contains the newly saved values
- (i) and (ii) — which for me always contain same data, that's weird! — seem to contain an EC-level snapshot stored at its (first) willChange. Also it looks like those “locally uncommitted changes” are based on (one of) these. So far though I haven't found a case when (i) would differ from (ii)... although, based on the name, I would actually presume (i) should be the same as (iii). It very definitely is not.
- (iv) I don't understand at all :(

Are those things somewhere documented in detail?

Thanks and all the best,
OC

Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster