summaryrefslogtreecommitdiff
path: root/src/cmd
AgeCommit message (Collapse)AuthorFilesLines
2022-07-17chore: make code more idiomatic, based on clippy warningsLars Wirzenius1-1/+1
Sponsored-by: author
2022-05-03refactor: add a type for plain integers we store in a databaseLars Wirzenius2-3/+4
This will make it easier to change later, if need be. We may want to do that for various reasons, such as to save space. We may also want to change things to only use integer types that SQLite can handle: u64 is currently not well handled by our database layer. However, as this is a refactor, there's no change or fix to that. FileId is now explicitly a database integer. This doesn't break anything, for now, as the underlying integer type is still u64. Also, change a couple of places where it will matter if DbInt changes away from u64, and disable warnings for harmless conversions that may cause warnings depending on what type DbInt has. Sponsored-by: author
2022-04-21feat: show-generation shows size of the generation's SQLite dbLars Wirzenius1-0/+9
Sponsored-by: author
2022-04-21feat: change "show-generation" output to JSONLars Wirzenius1-4/+34
This is more friendly towards anyone wanting to use the output in a script. 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 Wirzenius8-9/+66
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 Wirzenius4-1/+74
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 Wirzenius4-27/+22
Sponsored-by: author
2022-03-03refactor: use FileId instead of raw typeLars Wirzenius2-5/+7
This is clearer and less error prone. Sponsored-by: author
2022-01-16refactor: rename AsyncBackupClient to just BackupClientLars Wirzenius8-18/+18
There is only async. Sponsored-by: author
2021-12-31docs: add documentation comments to crateLars Wirzenius13-4/+83
Also, make it an error for a public symbol to not be documented. Sponsored-by: author
2021-12-05chore: tidy up things found by newer Rust toolchainLars Wirzenius1-16/+0
Sponsored-by: author
2021-10-24feat! store schema version of generation database in the dbLars Wirzenius2-0/+37
Add a new mandatory database table "meta" to the SQLite database the stores information about the files in a backup generation. The idea is for future versions of the Obnam client to be able to be able to restore from backups made by older -- or newer -- versions of Obnam, as far as is reasonable. Add the `obnam gen-info` command to show information about the generation metadata. 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-08-09Fix compilation on MacOSOssi Herrala1-1/+1
For chmod() we need to cast mode parameter from u32 to u16 because MacOS has 16 bit mode_t while Linux is using 32 bits.
2021-08-01refactor: use a struct for GenIdLars Wirzenius2-3/+3
This means a ChunkId can't be used instead. Sponsored-by: author
2021-08-01refactor: add a type alias for generation idsLars Wirzenius3-3/+3
This will make it harder to accidentally use a string. Can still be confused with a chunk id. Sponsored-by: author
2021-08-01feat: add command to resolve a generation ref into a chunk idLars Wirzenius2-0/+34
Sponsored-by: author
2021-07-30cleanup: fix things rustc/clipppy now complain aboutLars Wirzenius2-5/+5
Mostly https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow. 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-23refactor: async for "obnam show-generation"Lars Wirzenius1-5/+10
Sponsored-by: author
2021-07-23refactor: use async for "obnam restore"Lars Wirzenius1-18/+27
Sponsored-by: author
2021-07-23refactor: use async for "obnam list-files"Lars Wirzenius1-4/+10
Sponsored-by: author
2021-07-23refactor: use async for "obnam list"Lars Wirzenius1-3/+9
Sponsored-by: author
2021-07-23refactor: use async for "obnam get-chunk"Lars Wirzenius1-4/+9
Sponsored-by: author
2021-07-21Replace RestoreResult with plain ResultAlexander Batischev1-11/+9
2021-07-18fix: use an explicit tokio runtimeLars Wirzenius1-2/+3
Create a tokio runtime so that the non-async function for chunkify can call an async function and have that create and run background tasks. Brown paper bag mistake: I did the development of this in a separate program with an async main function. When I integrated it into Obnam proper, which doesn't have an async main function (yet), I didn't actually test it works, only that it compiles. Stupid, stupid, stupid. I know better. Sponsored-by: author
2021-07-18feat: add "chunkify" subcommandLars Wirzenius2-0/+105
Sponsored-by: author
2021-07-05refactor: code to run backups to have less repetitionLars Wirzenius1-61/+21
This should make it easier to introduce async, later.
2021-06-19chore: bump dependency on indicatif to 0.16, and fix what's neededLars Wirzenius1-1/+1
Change calls to set_message to pass ownership of the message, rather than just letting it borrow the message. Sponsored-by: author
2021-06-13feat: restore symlink metadataAlexander Batischev1-7/+14
The weird thing about this commit is that all the tests for it already exist: the subplot compares manifests of "live" and restored data, and that includes the mtime. The subplot passes on CI, and it passed for me too — until today. Today, if I run `./check` on the main branch (which is currently at 481c5d8df21c72db3a3d76e851d25426f3e40647), subplot fails because the symlinks' mtime is wrong. Most often it's just the nsec part that's wrong: tests run fast enough that they finish within a second, and they rarely happen at the edge of the second. I don't understand why this didn't happen to me before, and why it doesn't happen to CI — and to Lars, for that matter. git-bisect points at 755c18a11f87040245964cf411ea8f518b61e0f5, which is a couple months old, so we should've spotted the breakage by now. Needless to say, I didn't do any major overhauls of my system lately, just your usual `apt upgrade` (Debian bullseye/testing amd64). Did some change in Subplot or Summain obfuscate this? It bothers me that I don't understand how we could miss this for so long.
2021-05-31feat: add subcommands for encrypting, decrypting individual chunksLars Wirzenius2-0/+65
2021-05-29refactor: only have client config without passwordsLars Wirzenius3-9/+3
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-29feat: improve error messagesLars Wirzenius1-15/+34
All unclear error messages should now be clearer. For example, all the ones related to a file mention the file name and the attempted operation that failed.
2021-04-26Port chunkids() to the iterator APIAlexander Batischev1-1/+2
2021-04-26Extend the iterator to users of LocalGeneration::files()Alexander Batischev3-5/+6
2021-04-26Expose fallibility of individual SQL resultsAlexander Batischev3-7/+13
`LocalGeneration::sql::files()` runs an SQL query, iterates over the results and collects the rows into a `Vec`. This can fail at any step: the query might fail to run, or one of the rows might fail to be fetched or processed. Right now, we lump all those failures into a `Result` that wraps the whole return value. This is only possible because we process each row before returning. Once `Vec` is replaced by an iterator, we won't have that luxury anymore, so we now wrap each individual element into its own `Result` (as well as wrapping the whole vector into a `Result` of its own).
2021-04-21feat: add support for CACHEDIR.TAGAlexander Batischev1-2/+2
Fixes #78.
2021-04-10refactor: have ClientConfigWithoutPasswords know its filenameLars Wirzenius1-7/+2
This allows Init::run to not need to be given it as an argument.
2021-04-10refactor: struct ShowConfig subcommandLars Wirzenius2-6/+10
2021-04-10refactor: struct GetChunk subcommandLars Wirzenius2-11/+18
2021-04-10refactor: struct Restore subcommandLars Wirzenius2-26/+42
2021-04-10refactor: struct ListFiles subcommandLars Wirzenius2-13/+20
2021-04-10refactor: struct ShowGeneration subcommandLars Wirzenius2-23/+30