5
0
mirror of git://git.proxmox.com/git/pxar.git synced 2024-12-22 21:33:50 +03:00
Commit Graph

21 Commits

Author SHA1 Message Date
Christian Ebner
d51db63953 encoder/format: finish payload stream with marker
Mark the end of the optional payload stream, this makes sure that at
least some bytes are written to the stream (as empty archives are not
allowed by the proxmox backup server) and possible injected chunks
must be consumed.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-06-05 09:24:22 +02:00
Christian Ebner
3ee98e1072 decoder/accessor: allow for split input stream variant
When a pxar archive was encoded using the split stream output
variant, access to the payload of regular files has to be redirected
to the corresponding dedicated input.

Allow to pass the split input variant to the decoder and accessor
instances to handle the split streams accordingly and decode split
stream archives.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-06-05 09:24:22 +02:00
Christian Ebner
d3447d0149 format/examples: add header type PXAR_PAYLOAD_REF
Introduces the header type `PXAR_PAYLOAD_REF` to mark regular file
entry payloads, not encoded within the regular pxar archive but
rather redirected to a dedicated payload output writer.
It therefore substitutes the `PXAR_PAYLOAD` header type for these
entries.

The header marks the start and size for a `PayloadRef` typed object
in the archive, storing the offset to the payload header offset in the
payload stream of the dedicated payload output as well as the payload
size.

The `PayloadRef` provides the means to store, serialize and
deserialize the entry.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-05-23 14:39:11 +02:00
Christian Ebner
48431e5e38 encoder: move to stack based state tracking
In preparation for the proxmox-backup-client look-ahead caching,
where a passing around of different encoder instances with internal
references is not feasible.

Instead of creating a new encoder instance for each directory level
and keeping references to the parent state, use an internal stack.
Adds additional helper functions to solve borrow issues, when both
the state and writers have to be accessed by a mutable reference.

This is a breaking change in the pxar library API.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-05-23 14:39:11 +02:00
Christian Ebner
f5be8e5c6d format/examples: Fix typo in PXAR_PAYLOAD description
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-02-28 19:09:31 +01:00
Christian Ebner
00d36bf97b format: Document source of format const values
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2023-05-17 11:27:08 +02:00
Wolfgang Bumiller
71194b54e4 ditch anyhow crate in examples/tests
mostly to shutup our current buildbot tests

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-05-17 11:46:53 +02:00
Wolfgang Bumiller
a5b958d10c fix example
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-01-13 10:58:15 +01:00
Wolfgang Bumiller
57bee6f8f0 update mk-format-hashes for a new ENTRY
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-07-29 07:31:22 +02:00
Wolfgang Bumiller
37774a671d formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-25 12:14:07 +02:00
Wolfgang Bumiller
1b1e52a46a new hashes for the entire archive foramt
This breaks all previous pxar files and represents a clear
cut off of the catar format.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-24 13:31:34 +02:00
Wolfgang Bumiller
1250e3ea15 formatting fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-08 10:07:46 +02:00
Wolfgang Bumiller
145b50e682 examples: add hardlink support to pxarcmd
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-08 09:55:42 +02:00
Wolfgang Bumiller
62aaaa86d7 cleanup + failure -> anyhow transition
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-04-24 10:41:49 +02:00
Wolfgang Bumiller
21e2b2fa9b examples/pxarcmd: acreate archives recursively
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-03-04 16:39:07 +01:00
Wolfgang Bumiller
70acf63713 start with the encoder state machine
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-03-04 11:47:09 +01:00
Wolfgang Bumiller
5cf335be1d cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-02-20 11:16:35 +01:00
Wolfgang Bumiller
c76d3f980b pxarcmd example: implement 'cat'
and fix FileContentImpl offsets

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-02-19 16:31:23 +01:00
Wolfgang Bumiller
dc4a2854c0 implement lookup over multiple components
add a pxarcmd test example
make 'failure' an optional dependency as we only use it in
examples right now.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-02-19 16:03:50 +01:00
Wolfgang Bumiller
29c17fc072 huge accessor refactoring
Turn <'a> into <T: Clone + ReadAt>. We can still use `&'a
dyn ReadAt` in its place, but we can now also support using
an `Arc<File>` to create an Accessor of a 'static lifetime
for more convenient storage and reuse. This way the Accessor
can be thrown away after calling `open_root`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-02-19 10:54:14 +01:00
Wolfgang Bumiller
6cd4f635b6 import
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-02-18 14:08:02 +01:00