debian-forge/test/mod
David Rheinsberg 4df05b8509 util: add file system cache
This commit introduces a new utility module called `fscache`. It
implements a cache module that stores data on the file system. It
supports parallel access and protects data with file-system locks. It
provides three basic functions:

    FsCache.load("<name>"):
        Loads the cache entry with the specified name, acquires a
        read-lock and yields control to the caller to use the entry.
        Once control returns, the entry is unlocked again.

        If the entry cannot be found, a cache miss is signalled via
        FsCache.MissError.

    FsCache.store("<name>"):
        Creates a new anonymous cache entry and yields control to the
        caller to fill in. Once control returns, the entry is renamed
        to the specified name, thus committing it to the object store.

    FsCache.stage():
        Create a new anonymous staging entry and yield control to the
        caller. Once control returns, the entry is completely
        discarded.

        This is primarily used to create a working directory for osbuild
        pipeline operations. The entries are volatile and automatic
        cleanup is provided.

        To commit a staging entry, you would eventually use
        FsCache.store() and rename the entire data directory into the
        non-volatile entry. If the staging area and store are on
        different file-systems, or if the data is to be retained for
        further operations, then the data directory needs to be copied.

Additionally, the cache maintains a size limit and discards any entries
if the limit is exceeded. Future extensions will implement cache pruning
if a configured watermark is reached, based on last-recently-used
logics.

Many more cache extensions are possible. This module introduces a first
draft of the most basic cache and hopefully lays ground for a new cache
infrastructure.

Lastly, note that this only introduces the utility helper. Further work
is required to hook it up with osbuild/objectstore.py.
2022-12-06 09:48:38 +01:00
..
__init__.py test: '{. -> ./mod}/test_util_selinux.py' 2020-04-24 15:50:44 +02:00
test_api.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
test_buildroot.py osbuild: auto-detect best available runner 2022-10-11 12:49:16 +02:00
test_fmt_v1.py objectstore: direct path i/o for Object 2022-11-21 17:26:53 +01:00
test_fmt_v2.py osbuild: auto-detect best available runner 2022-10-11 12:49:16 +02:00
test_host.py host: add support for emitting signals 2022-02-22 10:38:43 +01:00
test_loop.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
test_meta.py meta: cache list of runners 2022-10-11 12:49:16 +02:00
test_monitor.py osbuild: auto-detect best available runner 2022-10-11 12:49:16 +02:00
test_objectstore.py objectstore: direct path i/o for Object 2022-11-21 17:26:53 +01:00
test_osbuild.py osbuild: auto-detect best available runner 2022-10-11 12:49:16 +02:00
test_util_checksum.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
test_util_ctx.py util/ctx: extract suppress_oserror() 2020-05-11 18:05:12 +02:00
test_util_fscache.py util: add file system cache 2022-12-06 09:48:38 +01:00
test_util_jsoncomm.py util/jsoncomm: add send_and_recv helper 2021-06-09 18:37:47 +01:00
test_util_linux.py linux: add Libc accessor with renameat2(2) 2022-12-06 09:48:38 +01:00
test_util_lorax.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
test_util_lvm2.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
test_util_osrelease.py test: make TestBase inherit unittest.TestCase 2020-06-05 09:27:40 +02:00
test_util_ostree.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
test_util_path.py global: fix PEP-8 formatting 2022-08-05 09:41:05 +02:00
test_util_pe32p.py util: add module to parse PE32+ files 2022-11-14 20:10:59 +01:00
test_util_rhsm.py global: fix PEP-8 formatting 2022-08-05 09:41:05 +02:00
test_util_rmrf.py test: convert to shared helpers 2020-05-13 14:26:05 +02:00
test_util_selinux.py util/selinux: add setfilecon method 2022-03-18 20:36:10 +01:00
test_util_udev.py devices: add custom udev rule inhibitor mechanism 2021-12-09 00:44:21 +00:00