You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: prompt.md
+74-1Lines changed: 74 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -262,4 +262,77 @@ These enhancements provide a robust, flexible, and session-specific backup syste
262
262
Notes for day 4:
263
263
We are getting very close, now we just need to sync with the other sessions.
264
264
265
-
In the same loop as the dump of the db, we now have to first check the other `uuid`'s databases, and merge them with ours.
265
+
In the same loop as the dump of the db, we now have to first check the other `uuid`'s databases, and merge them with ours. Like iterating over every folder under the `database` folder (exept ours).
266
+
267
+
This would require creating a new function to marge the data, and not use the restore database function.
268
+
269
+
I was checking JSDocs, and I like it, let's use it from now on (don't add it if the function doesn't have it, but for every new function yes).
270
+
271
+
--- day #4 start ---
272
+
273
+
# Backup Scheduler Enhancements Summary
274
+
275
+
This update to the `BackupScheduler` class in `backup-scheduler.ts` introduces two main improvements:
276
+
277
+
1.**Merging Backups from Other Sessions:**
278
+
279
+
-**What Changed:**
280
+
Before performing the auto dump, the scheduler now calls `mergeOtherSessionBackups()`. This function:
281
+
- Iterates through the `database` folder under the base backup directory.
282
+
- Excludes the current session (using `this.#sessionId`).
283
+
- For each other session, if a dump file (`database.yjs.db`) exists, it reads the file, converts it into a Yjs update, and applies it to the current Y.Doc.
284
+
-**Why:**
285
+
This allows merging of changes from multiple sessions (i.e., different installations/users) when syncing via a cloud storage solution.
-Whenimportinganewlocationincomputer2itcreatesnew`id`sforeachimage, whicharenotthesameastheoneincomputer1, tokindoffixitIrestoredthedatabasefromcomputer1tocomputer2, sotheycanhavethesame`id`. Whatweshoulddoisthatwhenimportingalocation, wefirstcheckifthereisn't a db already that we can copy
0 commit comments