DDC: Added optional versions of BuildAction, BuildDefinition, BuildOutput, CacheRecord

- Optional versions are now returned from operations that may fail.
- Fixed a bug in the cache where a null record could be dereferenced.
- Improved validation when loading build types.

#rb Zousar.Shaker
#rnx

[CL 16332909 by Devin Doucette in ue5-main branch]
This commit is contained in:
Devin Doucette
2021-05-14 14:47:11 -04:00
parent bbc1c87e68
commit 8ce8977949
12 changed files with 264 additions and 102 deletions

View File

@@ -483,17 +483,17 @@ FRequest FMemoryDerivedDataBackend::Get(
for (const FCacheKey& Key : Keys)
{
COOK_STAT(auto Timer = UsageStats.TimeGet());
FCacheRecord Record;
FOptionalCacheRecord Record;
if (FScopeLock ScopeLock(&SynchronizationObject); const FCacheRecord* CacheRecord = CacheRecords.Find(Key))
{
Record = *CacheRecord;
}
if (Record)
{
COOK_STAT(Timer.AddHit(CalcRawCacheRecordSize(Record)));
COOK_STAT(Timer.AddHit(CalcRawCacheRecordSize(Record.Get())));
if (OnComplete)
{
OnComplete({MoveTemp(Record), EStatus::Ok});
OnComplete({MoveTemp(Record).Get(), EStatus::Ok});
}
}
else