You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- ICacheStore::Put() has updated documentation to reflect the requirements of partial records. - ICacheStore::Get() now takes a FCacheRecordPolicy, which is implicitly constructible from ECachePolicy, and allows setting the policy by payload. - ICacheStore::GetPayload() is replaced by ICacheStore::GetChunks(), which allows loading parts of payloads. - ICacheStore::CancelAll() is moved to ICache::CancelAll() because the cache can track requests at the top level and cancel them without exposing cancellation on individual cache stores. - ECachePolicy::SkipLocalCopy has been removed because it is difficult to reason about. - ECachePolicy::SkipData flags now have a documented meaning for put requests, to hint that record existence implies payload existence. - The filesystem and memory cache stores have been updated to support partial records, filtering of payloads, and loading parts of payloads. - Requesting part of a payload will decompress the entire payload for now, until compressed buffers expose a way to decompress only part. - Fixed a bug in FTexturePlatformData::AreDerivedMipsAvailable() that caused it to return false for structured cache keys. #rb Zousar.Shaker #rnx #preflight 615e03241ed62f0001b95454 #ROBOMERGE-OWNER: Devin.Doucette #ROBOMERGE-AUTHOR: devin.doucette #ROBOMERGE-SOURCE: CL 17748550 in //UE5/Release-5.0/... via CL 17748555 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v879-17706426) #ROBOMERGE-CONFLICT from-shelf #ROBOMERGE[STARSHIP]: UE5-Main [CL 17748602 by Devin Doucette in ue5-release-engine-test branch]
127 lines
3.8 KiB
C++
127 lines
3.8 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "DerivedDataBackendInterface.h"
|
|
#include "DerivedDataCacheUsageStats.h"
|
|
|
|
// Macro for whether to enable the S3 backend. libcurl is not currently available on Mac.
|
|
#if !defined(WITH_HTTP_DDC_BACKEND)
|
|
#define WITH_HTTP_DDC_BACKEND 0
|
|
#endif
|
|
|
|
#if WITH_HTTP_DDC_BACKEND
|
|
|
|
namespace UE::DerivedData::Backends
|
|
{
|
|
|
|
typedef TSharedPtr<class IHttpRequest> FHttpRequestPtr;
|
|
typedef TSharedPtr<class IHttpResponse, ESPMode::ThreadSafe> FHttpResponsePtr;
|
|
|
|
|
|
/**
|
|
* Backend for a HTTP based caching service (Jupiter).
|
|
**/
|
|
class FHttpDerivedDataBackend : public FDerivedDataBackendInterface
|
|
{
|
|
public:
|
|
|
|
/**
|
|
* Creates the backend, checks health status and attempts to acquire an access token.
|
|
*
|
|
* @param ServiceUrl Base url to the service including schema.
|
|
* @param Namespace Namespace to use.
|
|
* @param OAuthProvider Url to OAuth provider, for example "https://myprovider.com/oauth2/v1/token".
|
|
* @param OAuthClientId OAuth client identifier.
|
|
* @param OAuthData OAuth form data to send to login service. Can either be the raw form data or a Windows network file address (starting with "\\").
|
|
*/
|
|
FHttpDerivedDataBackend(
|
|
const TCHAR* ServiceUrl,
|
|
const TCHAR* Namespace,
|
|
const TCHAR* OAuthProvider,
|
|
const TCHAR* OAuthClientId,
|
|
const TCHAR* OAuthData,
|
|
bool bReadOnly);
|
|
|
|
~FHttpDerivedDataBackend();
|
|
|
|
/**
|
|
* Checks is backend is usable (reachable and accessible).
|
|
* @return true if usable
|
|
*/
|
|
bool IsUsable() const { return bIsUsable; }
|
|
|
|
/** return true if this cache is writable **/
|
|
virtual bool IsWritable() const override
|
|
{
|
|
return !bReadOnly && bIsUsable;
|
|
}
|
|
|
|
virtual bool CachedDataProbablyExists(const TCHAR* CacheKey) override;
|
|
virtual TBitArray<> CachedDataProbablyExistsBatch(TConstArrayView<FString> CacheKeys) override;
|
|
virtual bool GetCachedData(const TCHAR* CacheKey, TArray<uint8>& OutData) override;
|
|
virtual EPutStatus PutCachedData(const TCHAR* CacheKey, TArrayView<const uint8> InData, bool bPutEvenIfExists) override;
|
|
virtual void RemoveCachedData(const TCHAR* CacheKey, bool bTransient) override;
|
|
virtual TSharedRef<FDerivedDataCacheStatsNode> GatherUsageStats() const override;
|
|
|
|
virtual FString GetName() const override;
|
|
virtual bool TryToPrefetch(TConstArrayView<FString> CacheKeys) override;
|
|
virtual bool WouldCache(const TCHAR* CacheKey, TArrayView<const uint8> InData) override;
|
|
virtual ESpeedClass GetSpeedClass() const override;
|
|
virtual bool ApplyDebugOptions(FBackendDebugOptions& InOptions) override;
|
|
|
|
void SetSpeedClass(ESpeedClass InSpeedClass) { SpeedClass = InSpeedClass; }
|
|
|
|
virtual void Put(
|
|
TConstArrayView<FCacheRecord> Records,
|
|
FStringView Context,
|
|
ECachePolicy Policy,
|
|
IRequestOwner& Owner,
|
|
FOnCachePutComplete&& OnComplete) override;
|
|
|
|
virtual void Get(
|
|
TConstArrayView<FCacheKey> Keys,
|
|
FStringView Context,
|
|
FCacheRecordPolicy Policy,
|
|
IRequestOwner& Owner,
|
|
FOnCacheGetComplete&& OnComplete) override;
|
|
|
|
virtual void GetChunks(
|
|
TConstArrayView<FCacheChunkRequest> Chunks,
|
|
FStringView Context,
|
|
IRequestOwner& Owner,
|
|
FOnCacheGetChunkComplete&& OnComplete) override;
|
|
|
|
static FHttpDerivedDataBackend* GetAny()
|
|
{
|
|
return AnyInstance;
|
|
}
|
|
|
|
private:
|
|
FString Domain;
|
|
FString Namespace;
|
|
FString DefaultBucket;
|
|
FString OAuthProvider;
|
|
FString OAuthClientId;
|
|
FString OAuthSecret;
|
|
FCriticalSection AccessCs;
|
|
FDerivedDataCacheUsageStats UsageStats;
|
|
TUniquePtr<struct FRequestPool> GetRequestPools[2];
|
|
TUniquePtr<struct FRequestPool> PutRequestPools[2];
|
|
TUniquePtr<struct FHttpAccessToken> Access;
|
|
bool bIsUsable;
|
|
bool bReadOnly;
|
|
uint32 FailedLoginAttempts;
|
|
ESpeedClass SpeedClass;
|
|
static inline FHttpDerivedDataBackend* AnyInstance = nullptr;
|
|
|
|
bool IsServiceReady();
|
|
bool AcquireAccessToken();
|
|
bool ShouldRetryOnError(int64 ResponseCode);
|
|
};
|
|
|
|
} // UE::DerivedData::Backends
|
|
|
|
#endif //WITH_HTTP_DDC_BACKEND
|