Goal

  • Today's goal is to start the work of having a unified way to access local and remote repositories. Part of this will exploring what's in the way of that.

Plan

  • Simplify error types for the BackupReposiory trait.

  • Decide how repository access needs to be configured, and implement that.

Notes

  • Currently the BackupRepository trait requires the implementation for a repository type to specify the error type. This means the caller needs to handle any possible error type, even if the error is wrapped in RepsitoryError::Underlying. When I implemented this originally I thought this was elegant. Now I think it's unnecessarily cumbersome. I'll make all trait objects return only RepostoryError errors and have variants for each implementing type.

    Done.

  • The way repository location and access is defined in the configuration file needs careful design. There are two options: either a local directory or a remote Obnam server instance. The directory is specified as a pathname, and the server with a URL.

    • repository: /mnt/backups
    • repository: https://backups.example.com/obnam
  • The two can be distinguished using syntax: if location can be parsed as a URL with a schema, it's a server instance. Otherwise, it's a pathname.

  • However, this leaves room for mistakes and accidents. It might be better to require the choice to be explicit. This also allows bundling access information or other related information in the same field. Something like:

    repository:
      server: https://backups.example.com/obnam
      token: FIXME
    

    Or:

    repository:
      directory: /mnt/backups
      unmount-after-success-backup: true
    
  • I like the extensibility of the explicit syntax and that it collects all configuration for one backup repository in one place. It's also easy to implement with serde.

  • Made it so.

  • I only changed the places that were using a local directory as repository to accept the new way to specify the repository, but only for local directories. Next I need to change them to also allow a remote Obnam server.

  • I've previously added type ClientRepository<R>, where R implements the BackupRepository trait. This is now preventing me from having a generic open_repository function, as it would need to return either ClientRepository<LocalRepository> or ClientRepository<ApiClient>. To fix this, I suspect I'm going to need to make ClientRepository into an enum. Unfortunately, that's too much work for today.

Summary

  • I made good progress towards letting user use a repository wherever it's located, but will need to continue this next time.

Support?

If you'd like to fund Obnam development, see my funding page. My high level goal is described on the architecture page. What is most important about backup software to you?