BackendOptions struct provides a unified way to configure backend connections in rustic. It handles repository paths, hot/cold storage setups, and backend-specific options.
BackendOptions Struct
Fields
repository
The main repository location. This is required to create a backend.RUSTIC_REPOSITORY
CLI Alias: -r, --repo, --repository
repo_hot
Optional hot storage location for a hot/cold repository setup.RUSTIC_REPO_HOT
options
Backend-specific options applied to both hot and cold repositories.options_hot
Backend-specific options applied only to the hot repository.options_cold
Backend-specific options applied only to the cold repository.Creating Backends
Basic Usage
With Options
Using Builder Pattern
Common Backend Options
Different backend types support different configuration options.Local Backend
%file- Full path to the file%type- File type directory name%id- File ID
REST Backend
retry- Number of retries ("false","off","default", or number)timeout- Request timeout (duration string, e.g.,"10m","30s")cacert- Path to CA certificate filetls-client-cert- Path to TLS client certificate
Rclone Backend
rclone-command- Custom rclone command (default:"rclone serve restic --addr localhost:0")use-password- Enable authentication (default:true)rest-url- Explicit REST URL (skips auto-detection)
OpenDAL Backend
retry- Number of retries ("false","off","default", or number)connections- Maximum concurrent connectionsthrottle- Bandwidth throttling (format:"<bandwidth>,<burst>", e.g.,"10MB,50MB")
Hot/Cold Repository Setup
A hot/cold setup uses two backends: a fast “hot” storage for frequently accessed data and slower “cold” storage for bulk data.Repository Location Formats
The repository location string determines which backend to use:Local
REST
Rclone
OpenDAL
Configuration File Usage
BackendOptions supports serialization for use in configuration files:Error Handling
Theto_backends() method returns an error if:
- No repository is specified:
- Invalid backend type:
- Backend initialization fails:
Related Types
- Backend Traits - Core backend interface traits
- Supported Backends - All available backend implementations
- SupportedBackend - Backend type enumeration