Commit Graph

12 Commits

Author SHA1 Message Date
Giuseppe Scrivano 53cb4adf9e
chunked: store file locations as binary
it reduces the cache file size by ~3%.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 9619a53b91)
2024-04-20 13:18:00 +02:00
Giuseppe Scrivano 950cac9339
chunked: store file names separately
so that the same file path is stored only once in the cache file.

After this change, the cache file measured on the fedora:{38,39,40}
images is in average ~6% smaller.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 59ac03970d)
2024-04-20 13:18:00 +02:00
Giuseppe Scrivano 98836f2647
chunked: use a bloom filter to speedup lookup
use a bloom filter to speed up lookup of digests in a cache file.

The biggest advantage is that it reduces page faults with the mmap'ed
cache file.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit e9a96e022d)
2024-04-20 13:18:00 +02:00
Giuseppe Scrivano 0d6e102042
chunked: store digest in binary format
use the binary representation for a given digest, it helps reducing
the file size by ~25%.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 33472545fb)
2024-04-20 13:18:00 +02:00
Giuseppe Scrivano 69bedaa9a2
chunked: fix unmarshaling of file names
The getString() function was used to extract string values, but it
doesn't handle escaped characters.  Replace it with iter.ReadString()
that is slower but handles escaped characters correctly.

Closes: https://github.com/containers/storage/issues/1878

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit f388a77afb)
2024-04-20 13:17:59 +02:00
Giuseppe Scrivano 7b5a939b3b
chunked: use mmap to load cache files
reduce memory usage for the process by not loading entirely in memory
any cache file for the layers.

The memory mapped files can be shared among multiple instances of
Podman, as well as not being fully loaded in memory.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 080dbaf67b)
2024-04-20 13:17:59 +02:00
Kir Kolyshkin fbd6ec62dc
pkg/chunked: rename metadata to cacheFile
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit f7e661fecc)
2024-04-20 13:17:59 +02:00
Giuseppe Scrivano 9c4ea20528
chunked: add chunk size to cache file
include the chunk length in the generated  file location format,
This enhancement is designed to facilitate the use of the cache by external
tools which may not have knowledge of the chunk size.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-02-26 20:58:52 +01:00
Giuseppe Scrivano 4d6767d078
chunked: reject unexpected data after TOC
handle cases where there is unexpected data following the
manifest in the JSON document.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-11-29 11:51:49 +01:00
Giuseppe Scrivano a50bb95770
chunked: support writing files in a flat dir format
so that they can be stored by their digest

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-07-04 17:45:41 +02:00
Nalin Dahyabhai 14e95ef777 Don't try to use %w in testing package logging functions
Go 1.18's testing package is adamant that it doesn't support the %w
specifier for wrapping errors, which makes sense because it outputs
text rather than producing an error object like fmt.Errorf() does.
Change attempts to use %w to %v.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2022-06-01 10:55:08 -04:00
Giuseppe Scrivano fd89b93ef3
chunked: add tests for the cache
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-01-13 13:32:13 +01:00