Document Timestamps
Is there a way to find the timestamp of the last edit made to a Document?
36 Replies
I also am not seeing anything for this from the api docs
Yeah
I want to know if something's been updated while my module is disabled
Iiiinnnnteresting
Oof, that's a brain teaser
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.
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?
because I can't imagine generating and comparing a hash for every document on ready would be very performant
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
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.
oof
Ok, dumb question
"Does it matter if the document has changed?"
@surged20 join us
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
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
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
The timestamps were to be able to know whether the Document has been deleted and readded
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.That might work, yes
yup, so document version as a flag that the updater groks would seem to work.
Indeed, I feel silly for overlooking a simple solution like this
that's why I was asking elsewhere about whether the idea was really about hashing transactions on the db..as we just need to track the actual entity content.
but didn't arrive at this
Yeah, using the db files makes this an external (non-module) tool, so not a fan
there's a couple use cases to consider
you have the versioned update..
but when the user is modifying a scene, you need support to mark that document version as dirty
We just tell Creators that all updates must be versioned using semver
I'm talking about the end consumer
they've got a scene in world that's part of their game..and the update shows up
it's got to be flagged as dirty to update in world
else they're not aware as end users that it's got data that will be lost
as I mentioned with stuff like the free league systems (well, the premium content)...they just warn you that everything will be destroyed on install
that's one use case I'd be concerned about...besides just unchanged updates from the content creator themselves.
so a version doesn't help that case unless a module managing this wraps db changes and adds something like
flags.myupdater.version = <content creator version>-dirty
when a user modifies a db entry.The issue is managing what happens if the module is disabled
heh
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
No, that would defeat the purpose
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
Maybe we only create hashes on load for Documents whose ID is in the flags with the same version
Yes, but it would become confusing for users if they ever disable it for any reason and then have their changes overwritten on update
i.e. it would mean that changes made with the module enabled are the only ones not always overwritten
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
seems like it would be the same class of module as dnd5e-extender..dangerous to disable?
I have to step out for an appointment, but would love to continue brainstorming this later with y'all
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
Or maybe instead of always running on load, we add a button to run the checks. I.e. "Update World"
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.
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.
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.
Not semver for the individual Documents, just for the world itself. i.e. the version in the manifest, etc.
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
gotchya
GitLab
[PROPOSAL] A World Merge conflict system for world updates; or migr...
Include a server side solution for worlds to be updatable from the provider. With the onset of the marketplace/premium...
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".
Is there a functional difference between this thread and a workgroup?
Another thing about this is that I've participated in this discussion on two other servers, so not everything/everyone is in one making a League proposal, although I don't know exactly how to do that
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
#158-world-updating