-
-
Notifications
You must be signed in to change notification settings - Fork 747
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a general Repository abstraction for remote and local repos
- Move repository.py -> repositories/local.py (LocalRepository) - Move remote.py -> repositories/remote.py - Add repository.py with Repository abstraction that proxies access to the above two classes - Have RPCErrors act like normal Errors so that general code doesn't have to know its particulars - Likewise, handle servers too old for nonce support internally to RemoteRepository - Have the Repository object say whether its backend is remote or not rather than hardcoding knowledge from class names
- Loading branch information
Showing
18 changed files
with
585 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
All About Repositories: Handling Protocols | ||
========================================== | ||
|
||
A repository is where borg keeps all its backup data. It abstracts the details of | ||
repositories in order to support multiple remote locations behind a similar interface. | ||
|
||
The top-level abstraction is the Repository class which then loads the | ||
appropriate specific repository class for the location specified by the user. | ||
|
||
For example, a ``file://`` location will end up loading a ``LocalRepository`` while | ||
an ``ssh://`` location will end up loading a ``RemoteRepository`` (which communicates | ||
with a remote borg instance over ssh). | ||
|
||
Adding A New Repository Backend | ||
------------------------------- | ||
|
||
You can see most of what needs to be done by looking at the main ``Repository`` | ||
class in ``repository.py``. Every call it gets, it proxies to a subclass that | ||
does the real work. That is what you'll write. | ||
|
||
A few of the methods are optional and can return ``None`` or do nothing: | ||
|
||
- ``get_free_nonce`` | ||
- ``commit_nonce_reservation`` | ||
- ``config`` (if remote) | ||
- ``save_config()`` (if remote) | ||
|
||
Write your new repository class in a file in the ``repositories`` directory. | ||
|
||
After writing your new class, add support for it in the ``Repository.__init__`` | ||
method, which inspects a location's protocol and instantiates the appropriate | ||
backend. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.