nodejs dropbox clone: nsync
I have created a github repo for the project: https://github.com/aishwar/nsync
The focus of this project (at this stage) is not on supporting advanced features (e.g. versioning, conflict resolution etc.) in file synchronization, but rather creating a basic app that provides file synchronization in a cross-platform way.
Here are the tasks I believe need to be done for us to have a basic working software:
- Running the app in client-mode/server-mode
Terminology: Each machine where changes to files can happen and that need to be synchronized is a client. The server is the coordinator of changes. All changes in the clients are sent to the server. When a client makes changes to the file system and informs the server, the server updates its copy with those changes and then informs the other clients. - Security mechanism of the server to ensure client connects to the intended server. If we have a client watching folder ‘A’ and another client watching folder ‘B’, we do not want client watching folder ‘A’ to try and sync with server for folder ‘B’
- File System representative object generation
Generating JSON representation of the file system. The JSON object should contain the names of the files and the hash value to represent their content. - Comparison of two file system objects to identify:
file adds,
file deletes, and
file changes - Client/Server delta computation on the server
- Client/Server sending file-system updates and ensuring it gets done
We will keep our conflict resolution simple: Last client wins. If clients A and B update a file. The last one to inform the server of the file update will be the winner regardless of who updated first.