However I found that the backends weren't well abstracted enough in v1 to make that easy.
However for v2 Thomas Waldmann has made a nice abstracted interface and the rclone code ended up being being only https://github.com/borgbackup/borgstore/blob/master/src/borg...