Document Timestamps

Aarcanist8/11/2021
Is there a way to find the timestamp of the last edit made to a Document?
CCalego8/11/2021
I also am not seeing anything for this from the api docs
Aarcanist8/11/2021
Yeah
Aarcanist8/11/2021
I want to know if something's been updated while my module is disabled
CCalego8/11/2021
Iiiinnnnteresting
CCalego8/11/2021
Oof, that's a brain teaser
CCalego8/11/2021
Spitballing from left-field:

You could generate a hash of some sort from the document data and store that as a flag. It would theoretically not be as heavy as storing the whole thing.
CCalego8/11/2021
Is this something you want to do a "is anything different" on ready or would "is this particular thing different" when that particular thing is opened?
CCalego8/11/2021
because I can't imagine generating and comparing a hash for every document on ready would be very performant
Aarcanist8/11/2021
I'm brainstorming a world update manager, so that content providers can provide updates to content without the user having to overwrite the entire world
Aarcanist8/11/2021
It has an export function which creators can initiate whenever they are about to release a new version. It would create a hash of every document and save that to the worlds flags.
Then, whenever that module is enabled during a world's load on a client, it will check for those static world flags and compare them to hashes of the current version. It can prompt the user if it wants to get the modified version, or delete the old version, etc.
CCalego8/11/2021
oof
CCalego8/11/2021
Ok, dumb question
CCalego8/11/2021
"Does it matter if the document has changed?"
Aarcanist8/11/2021
@Surge join us
UUUnknown User8/11/2021
Message Not Public
Sign In & Join Server To View
CCalego8/11/2021
Publisher pushes an update to the world. Doesn't the user want to update to that new version?

Picking some things to not update makes sense
UUUnknown User8/11/2021
Message Not Public
Sign In & Join Server To View
Aarcanist8/11/2021
The timestamps were to be able to know whether the Document has been deleted and readded
CCalego8/11/2021
Here's why I ask if it matters:

Without needing to generate hashes, "all this updater has to do" is keep track of a Document version number.

If the version number increments, it prompts the user if they want to update.
Aarcanist8/11/2021
That might work, yes
UUUnknown User8/11/2021
Message Not Public
Sign In & Join Server To View
Aarcanist8/11/2021
Indeed, I feel silly for overlooking a simple solution like this
UUUnknown User8/11/2021
2 Messages Not Public
Sign In & Join Server To View
Aarcanist8/11/2021
Yeah, using the db files makes this an external (non-module) tool, so not a fan
UUUnknown User8/11/2021
3 Messages Not Public
Sign In & Join Server To View
Aarcanist8/11/2021
We just tell Creators that all updates must be versioned using semver
UUUnknown User8/11/2021
7 Messages Not Public
Sign In & Join Server To View
Aarcanist8/11/2021
The issue is managing what happens if the module is disabled
UUUnknown User8/11/2021
2 Messages Not Public
Sign In & Join Server To View
Aarcanist8/11/2021
No, that would defeat the purpose
UUUnknown User8/11/2021
Message Not Public
Sign In & Join Server To View
Aarcanist8/11/2021
Maybe we only create hashes on load for Documents whose ID is in the flags with the same version
Aarcanist8/11/2021
Yes, but it would become confusing for users if they ever disable it for any reason and then have their changes overwritten on update
Aarcanist8/11/2021
i.e. it would mean that changes made with the module enabled are the only ones not always overwritten
UUUnknown User8/11/2021
2 Messages Not Public
Sign In & Join Server To View
Aarcanist8/11/2021
I have to step out for an appointment, but would love to continue brainstorming this later with y'all
Aarcanist8/11/2021
A mix of hashing and version numbers would avoid this: https://discord.com/channels/732325252788387980/875016328786903041/875025603504504832

We could test how it is on performance and perhaps provide a performance option for users which requires the module to never be disabled. This could be enabled or disabled at the user's whim even
Aarcanist8/11/2021
Or maybe instead of always running on load, we add a button to run the checks. I.e. "Update World"
CCalego8/11/2021
IMO a User knows what scenes they've changed and what changes they care to keep vs override with an update.

Making these updates not automatic is important. Having a user flow (prompted or otherwise) which asks the user which updated documents they want to import would be pretty sufficient in my mind.
CCalego8/11/2021
Although... My main concern with the hash idea was how performant that would be on world load. There's already a lot going on during world load (including migrations for system/module updates usually) and IMO it would be smarter to ask the user to start an update process.

If the hash + compare was only done during the 'update flow', and especially only for the documents whose versions incremented, it would help immensely with the performance.
CCalego8/11/2021
Semver is kinda overkill IMO. The world updater (and the user doing the import) only needs to know that a document has been changed, the magnitude of that change on a per-document level is more or less irrelevant.
Aarcanist8/11/2021
Not semver for the individual Documents, just for the world itself. i.e. the version in the manifest, etc.
Aarcanist8/11/2021
Yes, we don't want it completely automatic and there will be a prompt before each change, but I do want avoid implementing git merge which is what is in the Epic on GitLab
CCalego8/11/2021
gotchya
CCalego8/11/2021
If you want to put more eyes on this kind of thing in the future, don't hesitate to make a workgroup and pull people in to get more feedback. One of the things we do here is identify pain points and distill many devs feedback into one "League Proposal".
Aarcanist8/11/2021
Is there a functional difference between this thread and a workgroup?
Aarcanist8/11/2021
Another thing about this is that I've participated in this discussion on two other servers, so not everything/everyone is in one spot
Aarcanist8/11/2021
:vote: making a League proposal, although I don't know exactly how to do that
UUUnknown User8/12/2021
4 Messages Not Public
Sign In & Join Server To View
L[Lyra [he/him]8/12/2021
#158-world-updating