Files
UnrealEngineUWP/Engine/Source/Developer/Virtualization/Private/VirtualizationDDCBackend.h
paul chipchase 52d01bd36f The virtualization system may now take the project name as a parameter when it is initialized rather than trying to find it itself.
#rb PJ.Kack
#rnx
#preflight 62276138671c913c0515c3b4

- To make it easier to extend the number of parameters when initializing the virtualization system, the function has been changed to accept a single struct, FInitParams, which will contains all potential parameters.
- Calling the version of UE::Virtualization::Initialize without any parameters will fallback to using the default values.
- The virtualization manager now passes the provided project name onto each backend that it creates.
- The source control backend now stored the provided project name and uses that when creating the submit description for new payloads rather than polling FApp for the current project name.
-- This is required for the stand alone virtualization application which will not have a specific project set.

[CL 19303638 by paul chipchase in ue5-main branch]
2022-03-08 11:22:45 -05:00

58 lines
2.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "IVirtualizationBackend.h"
#include "DerivedDataCacheKey.h"
namespace UE::DerivedData { enum class ECachePolicy : uint32; }
namespace UE::Virtualization
{
/**
* A backend that uses the DDC2 as it's storage mechanism. It is intended to be used as a local caching
* system to speed up operations rather than for use as persistent storage.
*
* Ini file setup:
* 'Name'=(Type=DDCBackend, Bucket="XXX", LocalStorage=True/False, RemoteStorage=True/False)
*
* Required Values:
* 'Name': The backend name in the hierarchy.
*
* Optional Values:
* Bucket: An alphanumeric identifier used to group the payloads together in storage. [Default="BulkData"]
* LocalStorage: When set to true, the payloads can be stored locally. [Default=true]
* RemoteStorage: When set to true, the payloads can be stored remotely. [Default=true]
*/
class FDDCBackend final : public IVirtualizationBackend
{
public:
explicit FDDCBackend(FStringView ProjectName, FStringView ConfigName, FStringView InDebugName);
virtual ~FDDCBackend() = default;
private:
/* IVirtualizationBackend implementation */
virtual bool Initialize(const FString& ConfigEntry) override;
virtual EPushResult PushData(const FIoHash& Id, const FCompressedBuffer& Payload, const FString& PackageContext) override;
virtual FCompressedBuffer PullData(const FIoHash& Id) override;
virtual bool DoesPayloadExist(const FIoHash& Id) override;
private:
/** The bucket being used to group together the virtualized payloads in storage */
FString BucketName;
/** The FCacheBucket used with the DDC, cached to avoid recreating it for each request */
UE::DerivedData::FCacheBucket Bucket;
/** The policy to use when uploading or downloading data from the cache */
UE::DerivedData::ECachePolicy TransferPolicy;
/** The policy to use when querying the cache for information */
UE::DerivedData::ECachePolicy QueryPolicy;
};
} // namespace UE::Virtualization