Backup & Restore data model

The backup at this point is built as a append-log of changes to your database.

Memex internal data model

Memex stores different object types, like visits, pages or tags in 'collections'. You can explore those in the extension's background page > Application > IndexedDB > Memex.

Backup filenames (e.g. 1551324233820.txt)

The filename of the backup files represent the timestamp in ms of the creation of the file. It enables later to have a chronological way rebuilding your Memex database and sync between devices.

File structure (example: visits)
{
    "version": 1544659200000,
    "changes": [
        {
            "timestamp": 84000,
            "collection": "visits",
            "operation": "create",
            "objectPk": [
                1549930814313,
                "figma.com/file/QfOaebHnFEVTbuHGoxSnKv5t/Worldbrain?node-id=0:1"
            ],
            "object": {
                "url": "figma.com/file/QfOaebHnFEVTbuHGoxSnKv5t/Worldbrain?node-id=0:1",
                "time": 1549930814313
            }
        },
				{
            "timestamp": 84001,
            "collection": "visits",
            "operation": "create",
            "objectPk": [
                1549930814313,
                "figma.com/file/QfOaebHnFEVTbuHGoxSnKv5t/Worldbrain?node-id=136:478"
            ],
            "object": {
                "url": "figma.com/file/QfOaebHnFEVTbuHGoxSnKv5t/Worldbrain?node-id=136:478",
                "time": 1549930814313,
                "duration": 7084,
                "scrollPx": 0,
                "scrollPerc": 0,
                "scrollMaxPx": 0,
                "scrollMaxPerc": 0
            }
        },
		]
}

Timestamp: Creation of log change object in ms (may not be the same as file name because it may have been created way before) In this case the time stamp is an incremental number used for the initial bulk backup.

Collection: Datatype (collection name from Memex internal data model)

Operation: What is the nature of the change? Creation, deletion or update?

Version: A number indicating the version of the data model. This would allow for later changes to it and enable backwards compatibility in the restore/sync process.