summaryrefslogtreecommitdiff
path: root/src/cmd/backup.rs
AgeCommit message (Collapse)AuthorFilesLines
2022-10-26use new chunk store for all of client.rsLars Wirzenius1-3/+3
Sponsored-by: author
2022-10-23refactor: use clap instead of structoptLars Wirzenius1-4/+4
clap version 3 basically replaces structopt entirely. Sponsored-by: author
2022-07-17chore: make code more idiomatic, based on clippy warningsLars Wirzenius1-1/+1
Sponsored-by: author
2022-04-16feat: use one checksum for all chunks in a backupLars Wirzenius1-21/+31
When making a backup, use the same checksum for any chunks it re-uses or creates. This is for performance: if we allowed two checksums to be used, we would have to compute the checksum for a chunk twice, and potentially look up both on the server. This is just a lot of work. Instead, we use only one. The trade-off here is that when (not if) the user wants to switch to a new checksum type, they'll have to do a full backup, uploading all their data to the server, even when it's already there, just with a different checksum. Hopefully this will be rare. Full backups always use the built-in, hardcoded default checksum, and incremental backups use whatever the previous backup used. The default is still SHA256, but this commit add code to support BLAKE2 if we decide to switch that as a default. It's also easy to add support for others, now. BLAKE2 was added to verify that Obnam can actually handle the checksum changing (manual test: not in the test suite). I don't think users need to be offered even the option of choosing a checksum algorithm to use. When one cares about both security and performance, choosing a checksum requires specialist, expert knowledge. Obnam developers should choose the default. Giving users a knob they can twiddle just makes it that much harder to configure and use Obnam. If the choice Obnam developers have made is shown to be sub-optimal, it seems better to change the default for everyone, rather than hope that every user changes their configuration to gain the benefit. Experience has shown that people mostly don't change the default configuration, and that they are especially bad at choosing well when security is a concern. (Obnam is free software. Expert users can choose their checksum by changing the source code. I'm not fundamentally limiting anyone's freedom or choice here.) Users can switch to a new default algorithm by triggering a full backup with the new "obnam backup --full". Sponsored-by: author
2022-04-05feat: collect and log some time metricsLars Wirzenius1-7/+16
Log the complete run-time of the program, and the time spent downloading the previous generation, and uploading the new generation. Sponsored-by: author
2022-03-28Remove debug printsAlexander Batischev1-1/+0
2022-03-22feat! store list of generations in a "client trust root" chunkLars Wirzenius1-2/+15
Backups made with this version can't be restored with old clients, and vice version. Sponsored-by: author
2022-03-20feat: add subcommands inspect, list-backup-versionsLars Wirzenius1-1/+1
Sponsored-by: author
2022-03-20feat: allow user to choose backup schema version for new backupsLars Wirzenius1-4/+19
The way this is currently implemented resulted in a lot of code duplication in src/generation.rs. This should be refactored later. My first attempt to do it by adding a trait for a schema variant failed. Sponsored-by: author
2022-03-06refactor: use new database abstraction for generationsLars Wirzenius1-7/+8
Sponsored-by: author
2022-03-03refactor: use FileId instead of raw typeLars Wirzenius1-1/+2
This is clearer and less error prone. Sponsored-by: author
2022-01-16refactor: rename AsyncBackupClient to just BackupClientLars Wirzenius1-2/+2
There is only async. Sponsored-by: author
2021-12-31docs: add documentation comments to crateLars Wirzenius1-0/+4
Also, make it an error for a public symbol to not be documented. Sponsored-by: author
2021-08-16refactor: move file reading, etc, for backups to backup_runLars Wirzenius1-22/+4
Move code to read a file as chunks during a backup, and upload any new chunks to the chunk server, into `src/backup_run.rs`. Previously they were mostly in `src/client.rs`, which is meant to provide an abstraction for using the chunk server API. Sponsored-by: author
2021-08-09refactor: use async for "obnam backup"Lars Wirzenius1-11/+19
This changes things so that "obnam backup" uses async for everything. The old non-async BackupClient and ChunkClient are dropped. This does NOT move the chunking, and checksum computation, to its own function. This will happen later. Sponsored-by: author
2021-07-28Backup: exit non-zero if new tags are foundAlexander Batischev1-2/+6
2021-07-28Store backup_roots() outcome in a structAlexander Batischev1-5/+10
2021-07-28After the backup, print out a list of new CACHEDIR.TAGsAlexander Batischev1-3/+11
2021-07-05refactor: code to run backups to have less repetitionLars Wirzenius1-61/+21
This should make it easier to introduce async, later.
2021-05-29refactor: only have client config without passwordsLars Wirzenius1-2/+0
This means the config is always the config, and not sometimes the config or the config and passwords. Also, there's no config option for encrypting, anymore. It will not be optional now.
2021-04-21feat: add support for CACHEDIR.TAGAlexander Batischev1-2/+2
Fixes #78.
2021-04-10refactor: struct Backup subcommandLars Wirzenius1-13/+19
2021-04-10refactor: move ClientConfig into its own moduleLars Wirzenius1-1/+2
2021-04-09feat: add "obnam init" subcommandLars Wirzenius1-0/+2
This reads a passphrase and derives two passwords from that, and stores them next to the configuration file. The passwords aren't yet used for anything, that will come later.
2021-04-06refactor: clean up initial and incremental backup code paths a bitLars Wirzenius1-14/+16
2021-04-06fix: finish off and clear the incremental backup progress barLars Wirzenius1-0/+1
2021-03-12feat: show warnings for any problems backing up filesLars Wirzenius1-10/+30
Previously, we either ignored it or aborted the backup. Neither is good. Now we ignore the problem, except to show a warning at the end of the backup run.
2021-03-03fix: allow generation temporary files to be automatically deletedLars Wirzenius1-64/+47
By not calling NamedTempFile::persist, the files get deleted automatically when the file is closed or the struct is dropped. Previously we were deleting the temporary files manually, which meant that sometimes they weren't deleted if the program crashed at an unfortunate time.
2021-02-23feat: have separate progress bar for each backup phaseLars Wirzenius1-8/+8
2021-02-16refactor: use bytesize::MIB constant for clearer sizeLars Wirzenius1-1/+2
2021-02-16refactor: split BackupRun into initial, incremental variantsLars Wirzenius1-15/+25
This is clearer, easier to modify than having a flag to indicate which variant we're running.
2021-02-06feat! back up multiple rootsLars Wirzenius1-23/+47
This changes the client configuration file "root" field (with a single string) to "roots" (a list of strings).
2021-02-06feat: use the chunk size setting from the client configurationLars Wirzenius1-3/+7
Use the chunk_size setting for file data. For the SQLite file, use a hard-coded size instead.
2021-02-04refactor: have per-module error enumsLars Wirzenius1-3/+4
This means that a function that parses step bindings can't return an error that the document is missing a title. Such an error return would be nonsensical, and we use the Rust type system to prevent it, at a small cost of being a bit verbose. Additional benefit is that the library portion of Obnam doesn't return anyhow::Result values anymore.
2021-01-16feat: backup run now ends with a summaryLars Wirzenius1-3/+10
"obnam backup" now writes a summary like the following at the end: status: OK duration: 24 file-count: 119245 generation-id: ef353c79-a94f-4903-bd80-e741ea454c84 We can add more fields to that later, as needed and requested. This was the data that's easily at hand.
2021-01-05refactor: move policy on whether to back up a file into a moduleLars Wirzenius1-150/+13
This commit also splits up the src/cmd/backup.rs module into other, smaller, more cohesive modules that are easier to understand and use.
2021-01-04feat! record whether file was backed up and why, in a generationLars Wirzenius1-17/+57
This changes SQL schema.
2021-01-01feat! use signed 64 bit integers as file numbers, file countsLars Wirzenius1-2/+2
2020-12-31feat: incremental backupLars Wirzenius1-27/+111
This uses the previous, latest generation as a guideline to see what is new or changed.
2020-12-27refactor: rename Generation to NascentGenerationLars Wirzenius1-2/+2
New name is more descriptive.
2020-12-26refactor: rename FileSystemEntry::path to pathbufLars Wirzenius1-2/+3
This is a step towards changing how filenames are stored in FileSystemEntry.
2020-12-23feat: re-enable progress bars for backup and restoreLars Wirzenius1-1/+1
2020-12-23feat! add a global --config optionLars Wirzenius1-3/+1
This breaks all invocations of the Obnam client, as the option needs to come before the subcommand name. The benefit of this breakage is simpler, less repetitive code.
2020-12-12feat: back up and restore symlinksLars Wirzenius1-3/+9
2020-11-23feat: progress reporting to backups and restoresLars Wirzenius1-3/+30
2020-11-22feat! use temporary files for SQLite databasesLars Wirzenius1-2/+20
The user should not have to specify filenames for the databases, since they don't actually care where they're stored.
2020-11-18feat! change client config to take a base URL instead of host, portLars Wirzenius1-1/+1
2020-11-13refactor: put all client functionality into one programLars Wirzenius1-0/+21