Files
obsidian-livesync/docs/tech_info.md
T

2.9 KiB

Designed architecture

How does this plug-in synchronise.

Synchronisation

  1. When notes are created or modified, Obsidian raises some events. Self-hosted LiveSync catches these events and reflects changes into Local PouchDB.
  2. PouchDB automatically or manually replicates changes to remote CouchDB.
  3. Another device is watching remote CouchDB's changes, so retrieve new changes.
  4. Self-hosted LiveSync reflects replicated changeset into Obsidian's vault.

Note: The figure is drawn as single-directional, between two devices for demonstration purposes. Everything actually occurs bi-directionally between many devices at the same time.

File events and storage writes

File events describe changes observed in the Vault. Commonlib filters and serialises those events before updating file Metadata in the local database. A queued DELETE therefore requests a database change; it is not itself an instruction to delete the physical file. A rename out of the selected files can also become a database deletion while the destination remains on disk.

The opposite direction starts with database Metadata. Replicated changes and full scans can call the database-to-storage handler, which writes or removes Vault files subject to its conflict and content-preservation rules. Preventing a stale file event from deleting Metadata and applying a valid replicated deletion are separate decisions.

Commonlib's Storage events and database-to-storage reflection documents the event boundary, the deletion revalidation introduced in Commonlib 0.1.23, and its limits. In particular, deletion protection does not promise full support for external folder case changes or convergence of path spelling.

Current technical references

Techniques to keep bandwidth consumption low.

dedupe