summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2022-05-03refactor: add a builder for file system entriesLars Wirzenius2-83/+145
The previous commit introduced a function to create FilesystemEntry values from arbitrary data. Previously one could only be created from std::fs::Metadata. This complicated our own testing, which (now) needs to construct an arbitrary entry structure. However, while the function added in the last commit was straightforward, it had 11 arguments, and that's hard to keep track of. Replace that function with an EntryBuilder struct, for clarity. Sponsored-by: author
2022-05-03test: add test for storing, retrieving u64::MAX values in JSONLars Wirzenius3-15/+77
The test passes. We create a FilesystemEntry with a length field containing u64::MAX, store that into a generation, and read it back. This works. The entry is serialised into JSON for storing in SQLite, and this proves we can handle any u64 value in an entry. serde_json deals with it fine, and we don't need to worry about it. Sponsored-by: author
2022-05-03feat! only store signed 64-bit plain integers in databaseLars Wirzenius1-1/+14
This is a breaking change, but allows to store the largest signed 64-bit integers in SQLite and get it back. Sponsored-by: author
2022-05-03refactor: add a type for plain integers we store in a databaseLars Wirzenius4-17/+23
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 Wirzenius2-5/+36
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 Wirzenius8-41/+170
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-16feat! change how chunk labels are serializedLars Wirzenius4-18/+55
Serialized labels now start with a type prefix: a character that says what type of label it is. This isn't strictly required: we _can_ just decide to always use a single type of checksum for all chunks in one backup, for one client, or in the whole repository. However, if it's ever possible to have more than one type, it helps debugging if every checksum, when serialized, is explicit about its type. Change things to use the new serialize method instead of the Display trait for Label. We're primarily serializing labels so they can be stored in a database, and used in URLs, only secondarily showing them to users. Sponsored-by: author
2022-04-16refactor: rename Checksum to LabelLars Wirzenius10-39/+39
Label is a clearer and more accurate name for the type now that it is not just a checksum. Also, serialize a Label in tests, rather than using string literals. This is more correct, and we'll be changing serialization later. Sponsored-by: author
2022-04-16refactor: add a Literal variant to ChecksumLars Wirzenius3-6/+16
We've had fake checksums that are just arbitrary literal strings, and this change makes this more explicit. It's a preliminary change for later support for additional checksum algorithms. Sponsored-by: author
2022-04-06feat! add chunk server API version to HTTP pathsLars Wirzenius2-1/+9
What was /chunks is now /v1/chunks. This is the minimal step to start supporting multiple API versions. Also, /v1/chunks/foo/bar is no longer supported. Sponsored-by: author
2022-04-05feat: collect and log some time metricsLars Wirzenius5-32/+32
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-04-05feat: add data structures for accumulating time measurementsLars Wirzenius3-0/+199
Sponsored-by: author
2022-03-28Remove debug printsAlexander Batischev2-3/+0
2022-03-22feat! drop generation related fields from chunk metadataLars Wirzenius6-127/+17
Sponsored-by: author
2022-03-22feat! store list of generations in a "client trust root" chunkLars Wirzenius12-20/+210
Backups made with this version can't be restored with old clients, and vice version. Sponsored-by: author
2022-03-22fix: old typo in doc commentLars Wirzenius1-1/+1
Sponsored-by: author
2022-03-20feat: add subcommands inspect, list-backup-versionsLars Wirzenius5-1/+80
Sponsored-by: author
2022-03-20feat! on server, store chunk label in column called "label"Lars Wirzenius1-9/+9
Sponsored-by: author
2022-03-20feat: allow user to choose backup schema version for new backupsLars Wirzenius5-186/+509
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-20refactor: put SchemaVersion, GenMeta in their own modulesLars Wirzenius3-0/+232
For clarity, though these aren't yet used anywhere. That will happen soon. Sponsored-by: author
2022-03-13feat! rename metadata field "sha256" to "label"Lars Wirzenius6-31/+36
The field still contains a cleartext SHa256 of the cleartext chunk data, but this makes it clearer that it may contain other data. This is a breaking change: the server API won't work with an old client, and the new client won't work with an old server. To avoid the breakage would require more effort than is warranted at this time, given the very small number of users of Obnam. Sorry. Sponsored-by: author
2022-03-06refactor: add constant for showing/hiding progress reportingLars Wirzenius1-2/+4
This is clearer than editing literal values in the functions. Sponsored-by: author
2022-03-06perf: reduce logging for, for performanceLars Wirzenius2-8/+1
Sponsored-by: author
2022-03-06perf: cache user and group name lookupsLars Wirzenius3-29/+38
Sponsored-by: author
2022-03-06refactor: use new database abstraction for generationsLars Wirzenius7-335/+94
Sponsored-by: author
2022-03-06refactor: add a high level database abstraction for backupsLars Wirzenius2-7/+321
Sponsored-by: author
2022-03-06refactor: add a low level SQLite wrapperLars Wirzenius2-0/+634
This makes the code clearer and allows for catching more errors, albeit at runtime, such as using the wrong column name. Sponsored-by: author
2022-03-03refactor: use FileId instead of raw typeLars Wirzenius5-10/+13
This is clearer and less error prone. Sponsored-by: author
2022-01-19Merge branch 'skipped-fix' into 'main'Lars Wirzenius1-6/+8
fix: if a file is skipped, don't include it in the new backup Closes #177 See merge request obnam/obnam!213
2022-01-19fix: if a file is skipped, don't include it in the new backupLars Wirzenius1-6/+8
Sponsored-by: author
2022-01-19refactor: combine the chunk client into BackupClientLars Wirzenius1-69/+36
The split doesn't seem to make sense any more. Sponsored-by: author
2022-01-19refactor: rename AsyncBackupClient to just BackupClientLars Wirzenius10-33/+28
There is only async. Sponsored-by: author
2022-01-19chore: drop unused src/benhcmark.rs moduleLars Wirzenius2-39/+0
Sponsored-by: author
2022-01-16Merge branch 'skipped' into 'main'Lars Wirzenius2-1/+11
docs: add some explanation of what Skipped should mean See merge request obnam/obnam!212
2022-01-16docs: add some explanation of what Skipped should meanLars Wirzenius2-1/+11
Sponsored-by: author
2022-01-16refactor: rename Chunker to FileChunksLars Wirzenius2-5/+5
This should make it a little clearer that it can act as an iterator. Sponsored-by: author
2022-01-16Merge branch 'rename' into 'main'Lars Wirzenius10-98/+60
some refactorings Closes #181 and #182 See merge request obnam/obnam!209
2022-01-16refactor: combine the chunk client into BackupClientLars Wirzenius1-69/+36
The split doesn't seem to make sense any more. Sponsored-by: author
2022-01-16refactor: rename AsyncBackupClient to just BackupClientLars Wirzenius10-33/+28
There is only async. Sponsored-by: author
2022-01-16chore: drop unused src/benhcmark.rs moduleLars Wirzenius2-39/+0
Sponsored-by: author
2022-01-01chore: drop unused fsentry::ErrorAlexander Batischev1-8/+0
This type was superceded by fsentry::FsEntryError in a2adcb5a90c15b473a2fcf114555443fba8a20ce. Fixes #183.
2021-12-31feat: compare schema versions for compatibilityLars Wirzenius1-1/+63
When opening a local generation, check that it's compatible with the current version of Obnam. Sponsored-by: author
2021-12-31docs: add documentation comments to crateLars Wirzenius39-17/+508
Also, make it an error for a public symbol to not be documented. Sponsored-by: author
2021-12-05chore: drop unused fields in struct IndexLars Wirzenius1-13/+2
At this point, I don't know why the fields were there, but they are now not used at all, so they can be dropped. Sponsored-by: author
2021-12-05chore: tidy up things found by newer Rust toolchainLars Wirzenius3-26/+9
Sponsored-by: author
2021-11-27feat! turn errors from backup root directory into errorsLars Wirzenius2-2/+12
Previously an error from, say, a missing backup root directory was reported to the user as a warning. Turn it into an error. However, errors reading a file or directory inside the backup root should still be just a warning. Sponsored-by: author
2021-11-20chore: bump dependency on rusqlite to 0.26.1 and fix breakageLars Wirzenius2-9/+9
Sponsored-by: author
2021-11-20chore: update dependency on pbkdf2 to 0.9 and fix breakageLars Wirzenius1-1/+1
Sponsored-by: author
2021-10-24feat! store schema version of generation database in the dbLars Wirzenius4-0/+155
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