summaryrefslogtreecommitdiff
path: root/src/fsentry.rs
AgeCommit message (Collapse)AuthorFilesLines
2022-09-09chore: tidy up things to satisfy clippyLars Wirzenius1-1/+1
Sponsored-by: author
2022-05-03refactor: add a builder for file system entriesLars Wirzenius1-64/+137
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 Wirzenius1-12/+39
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-03-06perf: cache user and group name lookupsLars Wirzenius1-17/+18
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-31docs: add documentation comments to crateLars Wirzenius1-0/+26
Also, make it an error for a public symbol to not be documented. Sponsored-by: author
2021-08-09Fix compilation on MacOSOssi Herrala1-1/+6
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-07-21Replace FsEntryResult with plain ResultAlexander Batischev1-4/+2
2021-04-29feat: improve error messagesLars Wirzenius1-9/+4
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-03-27refactor: drop unnecessary conversions to the same typeLars Wirzenius1-1/+1
2021-03-03feat: store user and group who own each fileLars Wirzenius1-0/+30
Actually, these aren't yet actually stored in the backup. That will happen when there's a way to verify file metadata stored in the backup. But this adds the code to look up the data during a backup so that at least that part gets some exercise.
2021-02-19feat: backup and restore named pipes (FIFOs)Lars Wirzenius1-0/+6
2021-02-19feat: back up and restore Unix domain socketsLars Wirzenius1-5/+23
2021-02-04refactor: have per-module error enumsLars Wirzenius1-3/+14
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.
2020-12-31feat: incremental backupLars Wirzenius1-1/+1
This uses the previous, latest generation as a guideline to see what is new or changed.
2020-12-26feat! store pathnames a vectors of bytesLars Wirzenius1-3/+6
This is the most generic way to store filenames.
2020-12-26refactor: rename FileSystemEntry::path to pathbufLars Wirzenius1-2/+2
This is a step towards changing how filenames are stored in FileSystemEntry.
2020-12-12feat: back up and restore symlinksLars Wirzenius1-3/+22
2020-12-12feat: restore metadata as well as file contententsLars Wirzenius1-0/+24
2020-12-11add timestamps to fsentryLars Wirzenius1-8/+15
2020-12-11store mode in fsentryLars Wirzenius1-1/+13
2020-12-11refactor: how FsEntry structs are createdLars Wirzenius1-41/+17
Now from a Metadata struct, instead of a bunch of field values. The justification for this is that callers shouldn't have to unpack a Metadata, especially since it'll be different for each operating system in the future. Keep all that in one place instead.
2020-12-11feat! store file metadata as JSONLars Wirzenius1-2/+3
This avoids having to add extra columns when we add more metadata support. This may be worth re-thinking later, once things stabilize.
2020-11-09fix: minor fixes found by clippyLars Wirzenius1-0/+1
2020-11-08feat: add FileSystemEntry to store metadata about files, etcLars Wirzenius1-0/+118