summaryrefslogtreecommitdiff
path: root/src/cmd/restore.rs
AgeCommit message (Collapse)AuthorFilesLines
2024-03-03chore: upgrade dependency on indicatifLars Wirzenius1-1/+5
Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
2023-10-21chore: fix blemishes found by clippyLars Wirzenius1-1/+1
Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
2022-10-23refactor: use clap instead of structoptLars Wirzenius1-4/+2
clap version 3 basically replaces structopt entirely. Sponsored-by: author
2022-05-03refactor: add a type for plain integers we store in a databaseLars Wirzenius1-1/+1
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-03-22feat! store list of generations in a "client trust root" chunkLars Wirzenius1-1/+7
Backups made with this version can't be restored with old clients, and vice version. Sponsored-by: author
2022-03-06refactor: use new database abstraction for generationsLars Wirzenius1-16/+11
Sponsored-by: author
2022-03-03refactor: use FileId instead of raw typeLars Wirzenius1-4/+5
This is clearer and less error prone. Sponsored-by: author
2022-01-16refactor: rename AsyncBackupClient to just BackupClientLars Wirzenius1-4/+4
There is only async. Sponsored-by: author
2021-12-31docs: add documentation comments to crateLars Wirzenius1-0/+18
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-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 Wirzenius1-1/+1
This means a ChunkId can't be used instead. Sponsored-by: author
2021-08-01refactor: add a type alias for generation idsLars Wirzenius1-1/+1
This will make it harder to accidentally use a string. Can still be confused with a chunk id. Sponsored-by: author
2021-07-30cleanup: fix things rustc/clipppy now complain aboutLars Wirzenius1-4/+4
Mostly https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow. Sponsored-by: author
2021-07-23refactor: use async for "obnam restore"Lars Wirzenius1-18/+27
Sponsored-by: author
2021-07-21Replace RestoreResult with plain ResultAlexander Batischev1-11/+9
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-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 Batischev1-2/+2
2021-04-26Expose fallibility of individual SQL resultsAlexander Batischev1-0/+2
`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-10refactor: struct Restore subcommandLars Wirzenius1-23/+41
2021-04-10refactor: move ClientConfig into its own moduleLars Wirzenius1-1/+1
2021-03-27refactor: return assigned value directlyLars Wirzenius1-2/+1
2021-03-12fix: backup and restore of symlinkLars Wirzenius1-4/+2
2021-03-03fix: allow generation temporary files to be automatically deletedLars Wirzenius1-11/+2
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-19feat: backup and restore named pipes (FIFOs)Lars Wirzenius1-1/+17
2021-02-19feat: back up and restore Unix domain socketsLars Wirzenius1-12/+31
2021-02-07feat: if file can't be read, log that, don't end backup in errorLars Wirzenius1-1/+5
Such files won't be restored, as they'd be restored as empty file, and that would be confusing and thus bad.
2021-02-06feat: client verifies server's TLS certificate by defaultLars Wirzenius1-1/+1
Configuration setting can disable it.
2021-02-04refactor: have per-module error enumsLars Wirzenius1-14/+32
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-10feat! use SQLite db for chunk index on serverLars Wirzenius1-2/+3
This speeds startup a lot. However, the backup repository needs to be re-created from scratch and internal APIs have change in incompatible ways.
2021-01-05refactor: add BackedUpFile to avoid using a tupleLars Wirzenius1-5/+5
The struct is easier to use right.
2021-01-04feat! record whether file was backed up and why, in a generationLars Wirzenius1-2/+2
This changes SQL schema.
2021-01-01feat! use signed 64 bit integers as file numbers, file countsLars Wirzenius1-5/+5
2020-12-31refactor: add LocalGeneration type for read-only operationsLars Wirzenius1-19/+6
This splits the use of NascentGeneration to more cohesive "new generation being built" versus "existing generation being restored".
2020-12-30feat: allow restoring latest generationLars Wirzenius1-1/+9
2020-12-27refactor: rename Generation to NascentGenerationLars Wirzenius1-4/+4
New name is more descriptive.
2020-12-26refactor: rename FileSystemEntry::path to pathbufLars Wirzenius1-5/+6
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-0/+17
2020-12-12feat: restore metadata as well as file contententsLars Wirzenius1-16/+81
2020-11-23feat: progress reporting to backups and restoresLars Wirzenius1-2/+21
2020-11-22feat! use temporary files for SQLite databasesLars Wirzenius1-1/+15
The user should not have to specify filenames for the databases, since they don't actually care where they're stored.
2020-11-22refactor: use the same ClientConfig for both backups and restoresLars Wirzenius1-16/+2
2020-11-18feat! change client config to take a base URL instead of host, portLars Wirzenius1-3/+2
2020-11-13refactor: put all client functionality into one programLars Wirzenius1-0/+115