Commit Graph

1856 Commits

Author SHA1 Message Date
Dietmar Maurer 7123ff7d43 src/backup/data_blob.rs: avoid Arc<CryptConfig>
use simple reference instead.
2019-10-07 11:41:35 +02:00
Dietmar Maurer 4ee8f53d07 remove DataChunk file format - use DataBlob instead 2019-10-06 10:31:06 +02:00
Dietmar Maurer c26d4b4573 cleanup: remove dead code 2019-10-05 16:10:41 +02:00
Dietmar Maurer 88892ea801 src/bin/proxmox-backup-client.rs: cleanup restore
- write directly to /dev/stdout (instead of using stdout line writer)
- avoid BufferedFixedReader
2019-10-05 11:52:12 +02:00
Dietmar Maurer 62e05bb3b3 src/client/remote_chunk_reader.rs: pass reference to download_chunk
Make sure we do not move data around.
2019-10-05 11:45:20 +02:00
Dietmar Maurer c0b1b14c05 src/api2/reader.rs - download_chunk: use blocking io
Turns out to be twice as fast as tokio async io...
2019-10-05 11:41:19 +02:00
Dietmar Maurer ff01c1e393 src/client/http_client.rs: store raw data/blob size in index.json 2019-10-02 10:54:06 +02:00
Dietmar Maurer f16aea687a src/client/http_client.rs: new helper send_upload_request() 2019-09-28 18:22:48 +02:00
Dietmar Maurer 9e603e254c src/backup/fixed_index.rs: do not use offset for checksum 2019-09-23 11:30:20 +02:00
Dietmar Maurer fb6026b66b backup writer api: verify checksum inside close 2019-09-23 10:56:53 +02:00
Dietmar Maurer c8c4051aa7 src/client/http_client.rs - H2Client::upload: fix parameter order 2019-09-20 13:19:55 +02:00
Dietmar Maurer f011dba0f7 src/client/http_client.rs: add method parameter to H2 upload 2019-09-20 12:40:23 +02:00
Dietmar Maurer 792a70b9e1 src/client/http_client.rs: add content type parameter to H2 upload/requets_builder 2019-09-20 12:26:21 +02:00
Dietmar Maurer a55b2975db src/client/http_client.rs: cleanup (rename parameter) 2019-09-20 11:57:03 +02:00
Dietmar Maurer 32efac1cce remove trailing whitespace 2019-09-20 08:12:31 +02:00
Christian Ebner 70235f72f4 src/bin/proxmox-backup-client.rs: add functionality to mount pxar archive.
This adds the basic functionality to mount an archive stored in a repository
locally via fuse.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-20 08:01:01 +02:00
Christian Ebner 2fa91f5221 src/bin/pxar.rs: adapt to new deamonize flag
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-20 08:00:20 +02:00
Christian Ebner d388e244f5 src/pxar/fuse.rs: make verbose flag independent from deamonize by adding this as new flag
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-20 08:00:04 +02:00
Christian Ebner e717e9a3bf src/pxar/fuse.rs: refactor Session::new()
and add Session::from_decoder() in order to be able to create a fuse session
with a `Decoder` given as argument.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-20 07:59:51 +02:00
Christian Ebner 946b72a6b2 src/pxar/fuse.rs: introduce `Context` in order to add caching.
This patch introduces `Context` to hold the decoder, ino_offset and caches for
the attributes and the goodbye table.
By caching, certain callbacks can be handled without the need to read additional
data via the decoder, which improves performance.
The searching of the goodbye table is refactored as well, avoiding recursive
function calls in case of a hash collision.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-20 07:56:40 +02:00
Christian Ebner 1c93182371 src/pxar/decoder.rs: fix bug in decoder read
`offset` points to the `PXAR_FILENAME`, therefore read the filename before
the `PXAR_ENTRY`.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-20 07:54:16 +02:00
Dietmar Maurer 2aba16bde1 src/backup/data_chunk.rs: add into_raw() 2019-09-19 14:24:17 +02:00
Dietmar Maurer 15bb1bba89 BackupClient: add upload() function 2019-09-19 13:59:24 +02:00
Dietmar Maurer 6d4df36c3c make download_chunk_list() public 2019-09-19 13:17:23 +02:00
Dietmar Maurer cc2ce4a92f src/client/http_client.rs: add password parameter to HttpClient::new() 2019-09-16 12:35:23 +02:00
Christian Ebner 0e20b336e1 pxar: fuse: avoid possible hash collision in lookup by additional checking against filename
The hash of the filename in the goodbye table items allows to quickly compare to
a hashed filename.
Unfortunately, a matching hash is no garantee for matching filenames as hash
collisions are possible.
This patch fixes such possible collisions by further checking the filenames once
a matching hash has been found.
This introduces no significant extra cost (except for the filename comparison)
for cases with matching hashes, as the lookup call has to seek and read the file
attributes (including the filename) anyway.
In cases with hash collision, the next matching item is read and treaded
analogously (what means we need at least one extra seek).
As collisions should be not that frequent, this should be an acceptable penalty.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-16 10:22:22 +02:00
Wolfgang Bumiller ba5e67475a clippy: fix access to unaligned buffer in dynamic reader
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 14:50:45 +02:00
Wolfgang Bumiller b526bd1408 backup: cleanup unused imports
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 14:46:46 +02:00
Wolfgang Bumiller 4dc79bb1d9 clippy: fix access to unaligned buffer
via the newly introduced ReadExt::read_host_value_boxed()
from proxmox::tools::io.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 14:45:44 +02:00
Wolfgang Bumiller ccdf3ad1ec backup: use static assertion in fixed index reader
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 14:43:25 +02:00
Wolfgang Bumiller 34a3845b01 clippy: don't use clone a double reference
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 14:02:30 +02:00
Wolfgang Bumiller d159610265 buildsys: add 'make lint'
for now we only activate lints for code that is "outright
wrong"

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 13:59:58 +02:00
Wolfgang Bumiller b21851cc5c clippy: collapse identical if branches
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 13:57:58 +02:00
Wolfgang Bumiller 299a2f18b2 fixup variable naming
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 13:57:23 +02:00
Wolfgang Bumiller 175eeb870d clippy: use write_all in file logger
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 13:56:09 +02:00
Wolfgang Bumiller 5a54935bc9 clippy: fix pointer to temporary value
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 13:55:56 +02:00
Wolfgang Bumiller bd430c225b clippy: remove a loop{} which never actually loops
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 12:31:39 +02:00
Wolfgang Bumiller 44fed91e17 more clippy fixups
mostly indentation changes, view with `-w`

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 12:23:12 +02:00
Wolfgang Bumiller 653b1ca10e some clippy fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 12:14:05 +02:00
Wolfgang Bumiller ef0338d497 remove Cargo.lock
we currently have no git dependencies we need to lock into
specific revisions anymore

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 12:07:54 +02:00
Christian Ebner 03310bea12 src/pxar/fuse.rs: s/Buf/ReplyBuf/ and s/BufState/ReplyBufState/
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-11 11:27:18 +02:00
Christian Ebner 48cc1b8234 src/pxar/fuse.rs: refactor stat and fix i-node mapping
The functionality of stat is split into smaller sub-functions, which allows
to reuse them more flexible, as the code flow is similar but not always the same.
By this, the ugly and incorrect re-setting of the i-node in the lookup callback
function is avoided.
The correct i-node is now calculated beforehand and stat simply creates a
`libc::stat` struct from the provided parameters.
Also, this fixes incorrect i-node assignments in the readdir callback function.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-11 11:26:55 +02:00
Christian Ebner 22eaa905a4 src/pxar/fuse.rs: impl readdir callback for fuse
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 11:38:58 +02:00
Christian Ebner 1652192f4d src/pxar/fuse.rs: impl readlink callback for fuse
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 11:38:48 +02:00
Christian Ebner 3710b23db5 src/pxar/decoder.rs: read_link has to read filename before entry.
The offset points to the start of the item, which is the filename

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 11:36:04 +02:00
Christian Ebner 7eb9848ba7 src/pxar/fuse.rs: impl opendir callback for fuse
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 11:35:13 +02:00
Christian Ebner 2c5fd378d3 src/pxar/fuse.rs: impl read callback for fuse
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 11:34:55 +02:00
Christian Ebner 97e4db9dd5 src/pxar/fuse.rs: impl open callback for fuse
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 11:34:18 +02:00
Christian Ebner b00689254a src/pxar/fuse.rs: impl lookup callback for fuse
The lookup call checks if the given filename is found in the directory referenced
by the i-node by calclulating the filenames hash and looking it up in the
directories goodbye table.
If found, the entries parameters are returned.
In order to be able to lookup the parent offset by a given file offset in the
readdir callback, this also stores the corresponding values in a HashMap.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 10:54:23 +02:00
Christian Ebner 1443927c02 src/pxar/decoder.rs: correctly handle hardlinks in `Decoder`s attribute function
If the attributes are then returned by seeking to the new offset.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 10:46:39 +02:00