Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

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;
}

Actions

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:

  • Fetch

    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.

  • Sync

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.

  • Delete

The receiving device will delete all files from a specified location.


Action modelling

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.

Example (for fetching a single file):

{
    "root":{
        "directories": {},
        "files": {
            "": "date of last modification"
        }
    },
    "action": "Fetch",
    "path": "path/to/file"
}

Clone this wiki locally