Commit Graph

2560 Commits

Author SHA1 Message Date
Dietmar Maurer 9aa3f68278 src/bin/proxmox-backup-client.rs: code cleanup 2019-07-18 13:16:32 +02:00
Dietmar Maurer f6ede796ca src/bin/proxmox-backup-client.rs - status: only print result[data] 2019-07-18 09:52:11 +02:00
Dietmar Maurer 15c847f136 src/api2/admin/datastore.rs: allow to list all snapshots 2019-07-18 09:11:43 +02:00
Dietmar Maurer 0f73ee73bb src/cli/command.rs: set exit status on error 2019-07-17 13:40:10 +02:00
Christian Ebner 129dda4729 src/bin/pxar.rs: add --files-from parameter to pxar extract
Allows to pass a list of match pattern to the pxar extract call by reading them
from file.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-17 12:20:29 +02:00
Christian Ebner fa7e957ca3 pxar: Adapt SequentialDecoder::restore() calls to pass empty match pattern for full restore
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-17 12:19:31 +02:00
Christian Ebner d32c2e4d27 src/pxar/sequential_decoder.rs: adapt code for partial restore by match pattern
Allows to partially restore an archive by passing match patterns to the restore
function.
The whole restore is performed in sequential, therefore the whole archive has to
be read.
By wrapping the RawFd into an Option it can be controlled if the corresponding
part is restored (in case of Some(fd)) or if the Reader reads over it
without restore (in case of None).

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-17 12:11:37 +02:00
Christian Ebner 4902291673 src/pxar/sequential_decoder.rs: implement match_filename to match include pattern for partial restores
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-17 12:07:54 +02:00
Christian Ebner 894cd49ac4 src/pxar/sequential_decoder.rs: Also check for nul bytes when reading the filename
Check if the filename does not contain invalid nul byes when reading it from the
archive.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-17 12:04:41 +02:00
Christian Ebner 4204e53560 tests/pxar.rs: Change rsync options to --archive
By this the pxar integrity test checks for even more attributes such as a e.g.
correctly restored timestamp. See `man rsync` for details.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-17 09:46:42 +02:00
Christian Ebner 0b39674895 src/pxar/sequential_decoder.rs: remove old comments and refactoring
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-17 09:46:02 +02:00
Christian Ebner 9f8fcdd050 src/pxar/encoder.rs: refactoring of match_exclude_pattern()
match_exclude_pattern() does not need a '&mut self' reference to the encoder,
move it therefore out of the impl.
Further, this patch contains some naming and formatting cosmetics.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-17 09:45:19 +02:00
Christian Ebner 3ff4ef28e6 src/pxar/encoder.rs: remove unneeded dir_count
dir_count was used to track the number of directory entries to store in the
archive and bail if the maximum is exceeded.
As the number of entries is equally obtained from the list of the filenames to
include, use that one instead.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-17 09:44:59 +02:00
Christian Ebner a771f90745 src/pxar/exclude_pattern.rs: do not return partial matches for files
Partial matches make only sense for directories, files are always leafs of the
tree. Take this into account in order to avoid restoring of files which only
matched the front of a match pattern.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-17 09:44:06 +02:00
Christian Ebner bdf0d82ced src/bin/pxar.rs: Make pxar extract target optional
In order to improve usablity, the target on archive extraction will be the
current working directory by default.
A different target can be provided via the optional --target <PATH> parameter.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-17 09:40:02 +02:00
Dietmar Maurer 34a816cc7b src/bin/proxmox-backup-client.rs: add output-fromat options, implement status api 2019-07-16 13:35:25 +02:00
Dietmar Maurer 0eecf38fbf src/api2/admin/datastore.rs: add status api call 2019-07-16 13:34:38 +02:00
Dietmar Maurer 25500cfa26 src/cli/command.rs: add helpers/schema to format output 2019-07-16 11:46:58 +02:00
Dietmar Maurer aad2ee4947 src/bin/pxar.rs: only print archive name in verbose mode 2019-07-16 08:38:02 +02:00
Dietmar Maurer 6b9a071028 src/bin/pxar.rs: add --verbose parameter to list (replace dump) 2019-07-16 08:31:40 +02:00
Dietmar Maurer 2665cef703 src/bin/proxmox-backup-client.rs: make repository parameter optional
And allow to read it from $ENV{PBS_REPOSITORY}
2019-07-16 07:30:04 +02:00
Dietmar Maurer c8fc4fec8d Cargo.toml: update to latest hyper version
Which already includes our path.
2019-07-15 13:37:27 +02:00
Christian Ebner 3f5192730e src/pxar/format_definition.rs: fix typo
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-15 10:49:34 +02:00
Dietmar Maurer 9eae781ab8 src/bin/pxar.rs - extract: allow to read from stdin 2019-07-05 12:39:25 +02:00
Dietmar Maurer c6c9e093d0 src/bin/pxar.rs - dump: allow to read from stdin 2019-07-05 12:32:15 +02:00
Dietmar Maurer bf1252619a src/bin/proxmox-backup-client.rs - restore: allow to pipe output to stdout 2019-07-05 12:14:50 +02:00
Dietmar Maurer f8100e9623 src/bin/proxmox-backup-client.rs: remove download cli, do everything in restore 2019-07-05 11:36:45 +02:00
Dietmar Maurer f4bf7dfcc7 src/client/remote_chunk_reader.rs: implement simple caching 2019-07-05 10:42:46 +02:00
Dietmar Maurer afb4cd28be src/backup/fixed_index.rs: implement BufferedFixedReader 2019-07-05 09:19:56 +02:00
Christian Ebner be9b39e17a src/pxar/sequential_decoder.rs: major refactoring of restore_sequential()
This splits the functionality of restore_sequential() into several smaller
functions in order to allow to reuse them when restoring by seeking based on
the goodbye table offsets.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-05 06:45:50 +02:00
Christian Ebner 48a4509c67 src/pxar/encoder.rs: fix bug with incorrect offset stored in goodbye table
Commit cd7dc87903 introduced the special treatment
for .pxarexclude files when stored in the archive.
The incorrect placement of a code snipplet from this path leads to an incorrect
offset and size stored in the goodbye table.
This fix places the start to the correct position, restoring the previously
correct behaviour.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-05 06:39:39 +02:00
Christian Ebner 7dcbe051e9 pxar: Refactor SequentialDecoder to store the callback function within the struct
Reduces the number of arguments for the function calls within the decoder.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-05 06:38:22 +02:00
Dietmar Maurer b46c3fad03 src/backup/fixed_index.rs: use correct size
We need to consider that the last chunk may have smaller size.
2019-07-04 15:13:22 +02:00
Dietmar Maurer 9cc88a7c00 src/client/http_client.rs - finish: hold reference to avoid early connection close 2019-07-04 15:11:23 +02:00
Dietmar Maurer 5e04ec707d src/api2/backup/environment.rs: improve chunk alignment/size checks 2019-07-04 13:40:43 +02:00
Dietmar Maurer a24e3993e0 src/backup/chunk_store.rs: coding style fixes 2019-07-04 11:39:10 +02:00
Dietmar Maurer e4c2fbf170 src/backup/chunk_store.rs: additionally log chunk count 2019-07-04 11:27:11 +02:00
Dietmar Maurer 9850bcdf19 src/backup/chunk_store.rs: improve error reporting 2019-07-04 11:21:54 +02:00
Wolfgang Bumiller a3f3e91da2 backup/chunk_store: rework chunk iterator
We can now use iter::from_fn() which makes for a much nicer
logic. The only thing better is going to be when we can use
generators with `yield`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-04 10:55:17 +02:00
Dietmar Maurer 99168f43e6 src/client/http_client.rs: s/set_recv_buf_size/set_recv_buffer_size/ 2019-07-04 10:51:18 +02:00
Dietmar Maurer c698636a5d src/tools/fs.rs - read_dir: return nix::Result 2019-07-04 10:47:16 +02:00
Dietmar Maurer a57360983b src/backup/chunk_store.rs - get_chunk_iterator: return percentage inside iterator item 2019-07-04 09:26:44 +02:00
Dietmar Maurer 0f0a35b390 src/backup/dynamic_index.rs: lock file inside new, code cleanup 2019-07-04 08:17:30 +02:00
Dietmar Maurer a7c72ad9eb src/backup/fixed_index.rs - FixedIndexReader: remove reference to chunk store 2019-07-04 08:13:16 +02:00
Dietmar Maurer a660978c9a src/backup/datastore.rs: generic index_mark_used_chunks implementation, improve GC stats 2019-07-04 07:57:43 +02:00
Dietmar Maurer 86eda3eb0d src/bin/proxmox-backup-client.rs: implement restore using BackupReader 2019-07-03 15:45:12 +02:00
Dietmar Maurer b2a6897982 src/client/remote_chunk_reader.rs: remove dead code 2019-07-03 14:56:24 +02:00
Dietmar Maurer 7f99bf691a src/client/remote_chunk_reader.rs: implement remote chunk reader 2019-07-03 14:39:13 +02:00
Dietmar Maurer 4f6aaf542c src/client/http_client.rs: avoid compiler warning 2019-07-03 14:36:02 +02:00
Dietmar Maurer 3467cd91e9 src/client/http_client.rs: return Arc<Self>
Avoid to call canceller for each clone on drop ...
2019-07-03 14:26:07 +02:00