You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
This API adds a little bit of overhead but, in exchange: - Offers a path to migrate to the new Value API. - Offers a path to provide compression while falling back to the previous format. - Offers a path to backends batching requests without consuming a worker thread. - Avoids copying the value multiple times during async puts. #rb Zousar.Shaker #rnx #preflight 61e0a32fed50181feb57c5d6 #ROBOMERGE-AUTHOR: devin.doucette #ROBOMERGE-SOURCE: CL 18607028 in //UE5/Release-5.0/... via CL 18607056 via CL 18607101 #ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v899-18417669) [CL 18607126 by devin doucette in ue5-main branch]
113 lines
2.8 KiB
C++
113 lines
2.8 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "DerivedDataCache.h"
|
|
|
|
namespace UE::DerivedData { class FLegacyCacheKey; }
|
|
namespace UE::DerivedData { struct FLegacyCacheDeleteRequest; }
|
|
namespace UE::DerivedData { struct FLegacyCacheDeleteResponse; }
|
|
namespace UE::DerivedData { struct FLegacyCacheGetRequest; }
|
|
namespace UE::DerivedData { struct FLegacyCacheGetResponse; }
|
|
namespace UE::DerivedData { struct FLegacyCachePutRequest; }
|
|
namespace UE::DerivedData { struct FLegacyCachePutResponse; }
|
|
|
|
namespace UE::DerivedData
|
|
{
|
|
|
|
using FOnLegacyCachePutComplete = TUniqueFunction<void (FLegacyCachePutResponse&& Response)>;
|
|
using FOnLegacyCacheGetComplete = TUniqueFunction<void (FLegacyCacheGetResponse&& Response)>;
|
|
using FOnLegacyCacheDeleteComplete = TUniqueFunction<void (FLegacyCacheDeleteResponse&& Response)>;
|
|
|
|
class ILegacyCacheStore : public ICacheStore
|
|
{
|
|
public:
|
|
virtual void LegacyPut(
|
|
TConstArrayView<FLegacyCachePutRequest> Requests,
|
|
IRequestOwner& Owner,
|
|
FOnLegacyCachePutComplete&& OnComplete) = 0;
|
|
|
|
virtual void LegacyGet(
|
|
TConstArrayView<FLegacyCacheGetRequest> Requests,
|
|
IRequestOwner& Owner,
|
|
FOnLegacyCacheGetComplete&& OnComplete) = 0;
|
|
|
|
virtual void LegacyDelete(
|
|
TConstArrayView<FLegacyCacheDeleteRequest> Requests,
|
|
IRequestOwner& Owner,
|
|
FOnLegacyCacheDeleteComplete&& OnComplete) = 0;
|
|
};
|
|
|
|
class FLegacyCacheKey
|
|
{
|
|
public:
|
|
FLegacyCacheKey() = default;
|
|
FLegacyCacheKey(FStringView FullKey, int32 MaxKeyLength);
|
|
|
|
const FCacheKey& GetKey() const { return Key; }
|
|
const FSharedString& GetFullKey() const { return FullKey; }
|
|
const FSharedString& GetShortKey() const { return ShortKey.IsEmpty() ? FullKey : ShortKey; }
|
|
bool HasShortKey() const { return !ShortKey.IsEmpty(); }
|
|
|
|
bool ReadValueTrailer(FCompositeBuffer& Value) const;
|
|
void WriteValueTrailer(FCompositeBuffer& Value) const;
|
|
|
|
private:
|
|
FCacheKey Key;
|
|
FSharedString FullKey;
|
|
FSharedString ShortKey;
|
|
};
|
|
|
|
struct FLegacyCachePutRequest
|
|
{
|
|
FSharedString Name;
|
|
FLegacyCacheKey Key;
|
|
FCompositeBuffer Value;
|
|
ECachePolicy Policy = ECachePolicy::Default;
|
|
uint64 UserData = 0;
|
|
};
|
|
|
|
struct FLegacyCachePutResponse
|
|
{
|
|
FSharedString Name;
|
|
FLegacyCacheKey Key;
|
|
uint64 UserData = 0;
|
|
EStatus Status = EStatus::Error;
|
|
};
|
|
|
|
struct FLegacyCacheGetRequest
|
|
{
|
|
FSharedString Name;
|
|
FLegacyCacheKey Key;
|
|
ECachePolicy Policy = ECachePolicy::Default;
|
|
uint64 UserData = 0;
|
|
};
|
|
|
|
struct FLegacyCacheGetResponse
|
|
{
|
|
FSharedString Name;
|
|
FLegacyCacheKey Key;
|
|
FSharedBuffer Value;
|
|
uint64 UserData = 0;
|
|
EStatus Status = EStatus::Error;
|
|
};
|
|
|
|
struct FLegacyCacheDeleteRequest
|
|
{
|
|
FSharedString Name;
|
|
FLegacyCacheKey Key;
|
|
ECachePolicy Policy = ECachePolicy::Default;
|
|
bool bTransient = false;
|
|
uint64 UserData = 0;
|
|
};
|
|
|
|
struct FLegacyCacheDeleteResponse
|
|
{
|
|
FSharedString Name;
|
|
FLegacyCacheKey Key;
|
|
uint64 UserData = 0;
|
|
EStatus Status = EStatus::Error;
|
|
};
|
|
|
|
} // UE::DerivedData
|