[v0.7.0] Multiple repository synchronization

Since v0.7.0 syncthing supports multiple repository synchronization. This basically means that a single instance of syncthing can be set up to sync for example a Documents directory with peers A and B and a Photos directory with peers B and C.

In the initial release this is not well supported by the GUI. Specifically,

  • There is no support for configuring multiple repositories in the GUI. I want to actually consider how to make that nice instead of rushing something. In the meantime, it needs to be added manually to the config file, see below. The progress indicators (percentages) in the GUI show the sum of all repositories (i.e. 100% = all repositories are in sync).

  • Many things are still global that should be per repository, i.e. read only status and rate limiting.

  • In the current config format, the address for a node is specified each time it’s mentioned. That means multiple times if it syncs multiple repositories. However there’s only ever one connection to each peer node so specifying different addresses for different repositories doesn’t make sense and is undefined behavior.

  • The “id” attribute of one repository can be left blank (legacy), in which case it’s given the ID “default”. Repository ID:s must be unique so having more than one repository without an ID is an error.

Configuration example below. This sets up two repositories, one called default (implicit) in the directory ~/Documents and one called photos in the directory ~/Photos. The first directory is synced between the three peers n1, n2 and n3 while the second one is not shared with n3.

<configuration version="1">
    <repository directory="~/Documents">
        <node id="I6KAH7666SLLL5PFXSOAUFJCDZYAOMLEKCP2GB3BV5RQST3PSROA" name="n1">
            <address>127.0.0.1:22001</address>
        </node>
        <node id="JMFJCXBGZDE4BOCJE3VF65GYZNAIVJRET3J6HMRAUQIGJOFKNHMQ" name="n2">
            <address>127.0.0.1:22002</address>
        </node>
        <node id="373HSRPQLPNLIJYKZVQFP4PKZ6R2ZE6K3YD442UJHBGBQGWWXAHA" name="n3">
            <address>127.0.0.1:22003</address>
        </node>
    </repository>
    <repository id="photos" directory="~/Photos">
        <node id="I6KAH7666SLLL5PFXSOAUFJCDZYAOMLEKCP2GB3BV5RQST3PSROA" name="n1">
            <address>127.0.0.1:22001</address>
        </node>
        <node id="JMFJCXBGZDE4BOCJE3VF65GYZNAIVJRET3J6HMRAUQIGJOFKNHMQ" name="n2">
            <address>127.0.0.1:22002</address>
        </node>
    </repository>
    <options>
        ...
    </options>
</configuration>