This repository was archived by the owner on Sep 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
File Synchronization Protocol
Ana Andrișan edited this page Jun 9, 2022
·
12 revisions
File{
"name": String;
"modified": long;
}
Directory{
"directories": Directory[];
"files": File[];
}
Request{
"root": Directory;
"path": String;
"action": Sync|Fetch|Delete;
}They model the interactions between connected devices. Every device can receive three different requests from another device; each can target the entire shared folder (root), a subfolder or even a single file:
-
The receiving device will compare it's own files to the ones of the sender, and then it will send all new(er) files from the specified location back to the device that sent the request.
The receiving device will initially treat this request as a "Fetch" request. After that, it will then send a similar "Fetch" request back to the initial sender.
The receiving device will delete all files from a specified location.
When it is sent to a peer, each request file follows a specific template:
{
"root":{
},
"action": ,
"path":
}- root: contains subdirectories and files;
- action: the name of the action to be performed by the receiver;
- path: the targeted folder/subdirectory. If it's value is "", the entire synchronized folder is targeted.
{
"root":{
"directories": {},
"files": {
"": "date of last modification"
}
},
"action": "Fetch",
"path": "path/to/file"
}