A restic client written in rust

Hi there,

I had some sparse time in vacation and wanted to get some rust programming experience. So I decided to start a restic client in rust:

I’m willing to get more features implemented and would be happy to get a working and compatible client soon.

Feedback and contributions are very welcome!

5 Likes

Heh, nice! Although I must say that the names are too similar, any chance you’d be willing to use something entirely different? :slight_smile:

1 Like

I agree! What about aawsome-server and aawsome-backup :slight_smile:

I don’t see a problem with the new name - just document it as you wrote here. It’d be nice to see new stuff there, like compression, which has been “in the works” for eight years or so…

@MichaelEischer only started working on adding compression a few weeks ago

I also thought about the name and decided to let it as it is. The official name is actually “rustic-rs” which is also the crate name. I think that in the future the code will be separated in a library crate which provides all the functionality and a binary crate providing one ore more small binaries.

At the moment I’m trying to convert the logic to async Rust. That will be the next step in order to use async http client libraries and will allow to implement more backends.

About new features: Let me take to opportunity to advertise some of the existing new features. The backup command is already fully working:

alex@debian:~$ ./rustic-rs backup --help
rustic-rs-backup 
backup to the repository

USAGE:
    rustic-rs --repository <REPOSITORY> backup [OPTIONS] <SOURCE>

ARGS:
    <SOURCE>    backup source

OPTIONS:
        --exclude-if-present <FILE>    Exclude contents of directories containing filename (can be
                                       specified multiple times)
    -f, --force                        Use no parent, read all files
    -g, --glob <GLOB>                  Glob pattern to include/exclue (can be specified multiple
                                       times)
        --git-ignore                   Ignore files based on .gitignore files
        --glob-file <FILE>             Read glob patterns to exclude/include from a file (can be
                                       specified multiple times)
    -h, --help                         Print help information
        --iglob <GLOB>                 Same as --glob pattern but ignores the casing of filenames
        --iglob-file <FILE>            Same as --glob-file ignores the casing of filenames in
                                       patterns
    -n, --dry-run                      Do not upload or write any data, just show what would be done
        --parent <SNAPSHOT>            Snapshot to use as parent
        --with-atime                   Save access time for files and directories
    -x, --one-file-system              Exclude other file systems, don't cross filesystem boundaries
                                       and subvolumes

Note the *glob* options which allow include/exclude patterns and the --git-ignore option.

Also as a small improvement the number of nodes and total (restore) size of a snapshot is saved in the snapshots:

alex@debian:~$ ./rustic-rs -r /path/to/repo -p /path/to/key snapshots
 ID       | Time                | Host   | Tags | Paths                   | Nodes |      Size 
----------+---------------------+--------+------+-------------------------+-------+-----------
 a4c05cdd | 2022-03-06 23:31:16 | debian |      | /home2                  |     ? |         ? 
 760a8508 | 2022-03-06 23:40:22 | debian |      | /home2                  |   232 | 276.9 MiB 

The first snapshot was made by restic, the second by rustic (using the first as parent).

Of course it is much more easy to build a second implementation and early add some features there when there is always the reference implementation at hand.
But I hope we can use this second implementation to get benefits in both directions.

This could cause confusion: There is already a rustic which is a restic wrapper written in rust.

1 Like

Here is an update of what changed in rustic.

Actually I’m about to prepare a 0.2 release which features:

Happy to get feedback in form of bug reports, feature requests or PRs on the github page!

2 Likes

I made a pre-release 0.2.0rc1 which contains the following changes:

  • new commands: init, forget, prune, repoinfo, tag, key
  • allow parallel lock-free repo access including prune
  • added REST backend
  • add compression support
  • most operations are now parallelized (using async rust)
  • added more statistical information to snapshots
  • now uses the same JSON format for trees/nodes as restic
  • better progress bars
  • various small fixes

I’m looking for beta testers! A binary for linux is available at the link above, but you can of course also simply compile it yourself.

I just released rustic 0.2.0.
Binaries will follow soon.

If you have any comments or questions about rustic, feel free to join the discussions on github. I’m especially interested in which features you think should be implemented next.

2 Likes