Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #139

Merged
merged 2 commits into from Nov 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 14 additions & 5 deletions doc/design.md
Expand Up @@ -9,6 +9,8 @@ changes you made on them on other synced devices and on your online Cozy.
Metadata workflow
-----------------

![Metadata workflow](workflow.png)

Cozy-desktop is a nodejs app, written in coffeescript to be coherent with
other cozy codes. As its core, there is a pouchdb database used to keep
metadata about files and folders.
Expand All @@ -31,12 +33,19 @@ If a new file is added, cozy-desktop will ask one side to provide a nodejs
readable stream, and the other side will pipe it to its destination: a file on
the local filesytem, or a binary document on the remote couchdb.

**TODO:**

- add a schema
- explain how we avoid loops of metadata updates
- explain when conflicts happen and how they are resolved
- explain the special trick for renames and moves
Conflicts
---------

Conflicts can happen. For example, when cozy-desktop is stopped, a file is
added on the remote cozy and a different file is added to the local filesystem
at the same path. When cozy-desktop will start, it will detect that both the
remote cozy instance and the local filesystem have a file for the same path.

The conflict resolution is very simple: one of those file is renamed with a
`-conflict` suffix. A more evolved solution would have been very hard to
secure. And bugs in this part mean losing data, which is very bad. So, we
don't try to be smart and prefer a robust solution.


Documents schema
Expand Down
16 changes: 16 additions & 0 deletions doc/workflow.ditaa
@@ -0,0 +1,16 @@
Watcher Changes feed
(chokidar) /-------------\ (CouchDB)
+------------>| Merge |<------------+
| \------+------/ |
| | |
| | |
| V |
/------+------\ /-------------\ /------+------\
| File system | | PouchDB | | Remote Cozy |
\-------------/ \------+------/ \-------------/
^ | ^
| | |
| V |
| /-------------\ |
+-------------+ Sync +-------------+
\-------------/
Binary file added doc/workflow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.