From f2f4c34760de661f1dfe33c06760053692fece90 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 8 Nov 2020 16:15:52 -0800 Subject: 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. --- src/rmd_cache.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/rmd_cache.h') 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 +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 -- cgit v1.2.3