diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2020-11-08 16:15:52 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2020-11-08 19:50:50 -0800 |
commit | f2f4c34760de661f1dfe33c06760053692fece90 (patch) | |
tree | 97a56e0bf2b5a73825422a5f057ed44e7d189865 /src/rmd_cache.h | |
parent | 937f09dd3532a2033e9bf159bed842bfd1f3ad2a (diff) |
cache: introduce rudimentary CacheFile API
Throughout the existing cache-related code there's constant checking
if compression is active or not.
This commit introduces a CacheFile ADT with the intention of
replacing all the open coded stuff with simple calls into
rmdCacheFile* functions operating on CacheFile instances.
The management of split up cache files has also been implemented
behind this API, so the reads and writes will transparently
handle the split files. These have been named "chapters" in new
code.
No callers have been changed, this only adds the new facility. A
subsequent commit will migrate things over.
Diffstat (limited to 'src/rmd_cache.h')
-rw-r--r-- | src/rmd_cache.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rmd_cache.h b/src/rmd_cache.h index 9f4acce..cfa6cae 100644 --- a/src/rmd_cache.h +++ b/src/rmd_cache.h @@ -34,6 +34,10 @@ #include <stdio.h> +CacheFile * rmdCacheFileOpen(ProgData *pdata, const char *path, CacheFileMode mode); +int rmdCacheFileClose(CacheFile *file); +ssize_t rmdCacheFileRead(CacheFile *file, void *ptr, size_t len); +ssize_t rmdCacheFileWrite(CacheFile *file, const void *ptr, size_t len); /** * Change file pointer to a new file while writting |