5
0
mirror of git://git.proxmox.com/git/pxar.git synced 2025-01-05 17:17:39 +03:00
Commit Graph

16 Commits

Author SHA1 Message Date
Christian Ebner
be5d68aa8a format/encoder/decoder: new pxar entry type Prelude
Introduces a new pxar format entry type `Prelude` and the associated
encoder and decoder methods.
A prelude starts with header marker `PXAR_PRELUDE` followed by raw
byte content, used to store additional metadata associated with the
pxar archive, e.g. command line arguments passed on archive creation.

The prelude's content has no fixed encoding format but is stored as
an raw, arbitrary byte slice. A prelude entry is encoded right after
a pxar format version entry, both being encoded in the metadata
archive in case of an archive with dedicated payload output.

The prelude is not backwards compatible to pxar format version 1.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-06-05 09:24:22 +02:00
Christian Ebner
0983094c87 format/encoder/decoder: new pxar entry type Version
Introduces a new pxar format entry type `Version` and the associated
encoder and decoder methods. The format version entry is only allowed
once, as the first entry of the pxar archive, marked with a
`PXAR_FORMAT_VERSION` header followed by the encoded version number.
If not present, the default format version 1 is assumed as encoding
format for the archive.

The entry allows to early detect incompatibility with an encoded
archive and bail or switch mode based on the encountered version.

The format version entry is not backwards compatible to pxar format
version 1.

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
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
Wolfgang Bumiller
85f5a177ef test socket/fifo entry kinds in accessor
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-10-27 15:18:20 +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
318462ea3d fix decode_entry on special files
When using the random accessor to access FIFOs or sockets,
the ranged reader limits the data to only that entry, and
the `decode_entry` will never see a `PAYLOAD` or
`GOODBYE_TABLE` item to finish the entry.
Instead, it'll reach EOF and we need to handle this.
The accessor now tells the decoder to expect EOF as a valid
condition for ending the entry.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-12-15 11:34:15 +01:00
Wolfgang Bumiller
c81b2e4e21 add some random access tests with hardlinks
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-26 14:12:57 +02:00
Wolfgang Bumiller
807a4fd6ba tests: add some ACLs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-26 13:05:22 +02:00
Wolfgang Bumiller
1feb04d7b8 tests: cleanup warnings
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-26 11:20:45 +02:00
Wolfgang Bumiller
650070b0e6 tests: add fifos and sockets
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-26 11:12:00 +02:00
Wolfgang Bumiller
bb74cbfa21 document test helpers a bit
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-26 10:08:45 +02:00
Wolfgang Bumiller
ea8ff6368b remove custom PartialEq impl
Hardlink targets are now compared, but only the parts we
also actually decode, not the chosen names in
`Entry.link_key`.

This way we can just `==` compare entries as long as the
files we use for hardlinking use their canonical path as
key.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-26 09:57:35 +02:00
Wolfgang Bumiller
1829ef0dd0 some initial sequential encoder/decoder testing
Tests basic files, hardlinks, symlinks. No special metadata
yet.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-26 09:54:00 +02:00
Wolfgang Bumiller
8fe6038295 formatting fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-25 13:56:48 +02:00
Wolfgang Bumiller
139932923c start tests directory
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-25 13:51:22 +02:00