diff options
| author | Dan Engelbrecht <[email protected]> | 2023-11-08 15:25:56 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-08 15:25:56 +0100 |
| commit | b8460468bcdb9f331d06afb2b3b9967bdf915aab (patch) | |
| tree | d398e0b6c1d8590c237ff8611020621d942078f1 /src/zenserver/cache/cachedisklayer.h | |
| parent | implemented openssl-free encryption for Windows (#520) (diff) | |
| download | zen-b8460468bcdb9f331d06afb2b3b9967bdf915aab.tar.xz zen-b8460468bcdb9f331d06afb2b3b9967bdf915aab.zip | |
disk layer gc and error/warnings cleanup (#515)
- Improvement: Use GC reserve when writing index/manifest for a disk cache bucket when disk is low when available
- Improvement: Demote errors to warning for issues that are not critical and we handle gracefully
- Improvement: Treat more out of memory errors from windows as Out Of Memory errors
Fixed wrong sizeof() statement for compactcas index (luckily the two structs are of same size)
Diffstat (limited to 'src/zenserver/cache/cachedisklayer.h')
| -rw-r--r-- | src/zenserver/cache/cachedisklayer.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/zenserver/cache/cachedisklayer.h b/src/zenserver/cache/cachedisklayer.h index 4b9d4ed1e..99c54e192 100644 --- a/src/zenserver/cache/cachedisklayer.h +++ b/src/zenserver/cache/cachedisklayer.h @@ -331,12 +331,14 @@ private: IoBuffer GetStandaloneCacheValue(ZenContentType ContentType, const IoHash& HashKey) const; void PutInlineCacheValue(const IoHash& HashKey, const ZenCacheValue& Value, std::span<IoHash> References); IoBuffer GetInlineCacheValue(const DiskLocation& Loc) const; - void MakeIndexSnapshot(); + void MakeIndexSnapshot(const std::function<uint64_t()>& ClaimDiskReserveFunc = []() { return 0; }); uint64_t ReadIndexFile(const std::filesystem::path& IndexPath, uint32_t& OutVersion); uint64_t ReadLog(const std::filesystem::path& LogPath, uint64_t LogPosition); void OpenLog(const bool IsNew); CbObject MakeManifest(IndexMap&& Index, std::vector<AccessTime>&& AccessTimes, const std::vector<BucketPayload>& Payloads); - void SaveManifest(CbObject&& Manifest); + void SaveManifest( + CbObject&& Manifest, + const std::function<uint64_t()>& ClaimDiskReserveFunc = []() { return 0; }); CacheValueDetails::ValueDetails GetValueDetails(const IoHash& Key, PayloadIndex Index) const; void CompactReferences(RwLock::ExclusiveLockScope&); void SetReferences(RwLock::ExclusiveLockScope&, ReferenceIndex& FirstReferenceIndex, std::span<IoHash> References); |