Replies: 3 comments 9 replies
-
I would love that. From a database perspective, everything gets a lot more complicated if users are allowed to change the primary identifier, whether that's the ID or title, so having a fixed ID would be wonderful. Currently MWS is using the insert id for a revision number. It's ingenious, but it's not a sufficient solution for revision tracking and a globally unique identifier would be a lot more useful. Having a primary key like this is basically required for revision tracking so I probably would have proposed it whenever we got around to that, but you know way more about the tiddler side of things than I do. I'm pretty sure the title would still have to be unique, and we could easily maintain a unique index on the server side. Should the recipe system overlay based on UUID or title or both? If the same identifier has two different titles on two different layers they would both be visible unless we Make sure we take the top identifier and top title. |
Beta Was this translation helpful? Give feedback.
-
Thanks @pmario. UUIDs have come up several times before over the years. After a good deal of discussion and though, I have come to the conclusion that there is no benefit in rearchitecting TiddlyWiki to use UUIDs as the primary key for tiddler storage, and that it could only be done with significant redundancy, and poor performance. I understand that it may take some further discussion to persuade others, and so let's do so as much as needed. To start with, you note:
The simplest way to handle that request is to use a field to store the UUID. Some tweaking is necessary to assign a new UUID each time a tiddler is created. One of the characteristics of UUIDs is that no matter where and when they are created they are guaranteed to be unique, which means that there shouldn't be multiple tiddlers sharing the same UUID. With the UUID in an ordinary field, the standard machinery of TiddlyWiki ensures that the UUID is preserved across edits. Most of the rest of the OP is really about a separate idea: to rearchitect TiddlyWiki/MWS to use UUIDs as the primary key. The fact that the post is so long hints at the problem: this is a very complex proposal that adds a good deal of complexity to TiddlyWiki. There is immediately a fundamental incompatibility because using UUIDs as the primary key breaks the usual semantics of a new tiddler overwriting a previously existing tiddler with the same title. Additional mechanisms can be overlayed to add the title field semantics, but the result is much, much more complicated than what we have now. One of the key characteristics of TiddlyWiki is that it establishes a very, very simple and easy to understand data model that is rich enough to support all the higher level structures that a conventionally encountered in programming. For that reason, making the basic semantics more complicated is not acceptable. With all that said, I think there may be a role for UUIDs in MWS: as identifiers for revisions of a tiddler. This approach does not cause any problems with TiddlyWiki's existing semantics, and it is useful for external tooling to be able to refer unambiguously to a snapshot of a tiddler. |
Beta Was this translation helpful? Give feedback.
-
IMO the purpose of using UUID shouldn't be storing timestamps. It may be better to identify unique tiddler by its UUID rather than the title. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It is proposed to use UUID v7 as a tiddler ID for MWS related data storages.
The Update Motivation describes the technical details and what's special about the new UUID versions.
Also have a closer look at: DBMS and Database Considerations
I will summarize what I think is important for TW in my own thoughts here:
Database related
5.1 They can be stored as text, where they need more storage space
5.1.2 For easier debugging at the beginning it should be stored as text
5.3 They can be stored as 16byte binary data for better storage (See Database Considerations link above)
For TW
created
field anymore, since it can be replicated from the tiddler ID. See "Backwards Compatibility Considerations"modified
field may have the same properties ascreated
. But UUID v8 may be an option too$:/config/TimestampDisable
For Users
Core Internals
Currently there are 5 fields which use special treatment by the core js code.
20.1 created, modified, color, tags and list
20.2 See source code at boot.js
created
andmodified
implement 2 functions21.1 parse ... which converts TW data format to Unix date timestamp
21.2 stringify ... which converts a Unix timestamp into a TW date, which is almost human readable 20250213171512000
Backwards Compatibility Considerations
modified
field stays as it is and can be influence by$:/config/TimestampDisable
created
field will be calculated fromUUID7
instead of a JS Date() variablePossible Upgrade Path(s)
The TW browser upgrader and the browser $:/Import process call an
upgrade
function, that will allow us to generate new IDs from existingcreated
and ormodified
fields, if neededIf there is no created field like for shadow tiddlers, TODO !!!!!!!!!!!!!!!
UUID7 replaces
created
field so$:/config/TimestampDisable
will not effectcreated
anymoremodified-7
field is added //may be UUID v8// TODO !!!!!!!!!!!!JSON export
Source of Truth
In the Future
Server Side
created
andmodified
are just a data fieldsmodified-7
may be UUID v8 with a SHA256 hash incustom_b
andcustom_c
structure -- TODO !!!!!!!!!!!!!! more thoughts neededImplementation Details (MVP prototype)
UUID code would look as follows. TODO: proper testing.
It implements uuid
.v7 ... which should return a string eg: 0195002c-02ac-743d-a29f-cb3f978015c0
.validate ... validates an input if created from a 3rd party
.parse ... convert UUID string into byte array
.stringify ... converts byte array to UUID string
@Arlen22, @Jermolene, @saqimtiaz -- what do you think?
@sukima This may also be interesting for your TiddlyMap replacement as tiddler ID.
Beta Was this translation helpful? Give feedback.
All reactions