You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb Per.Larsson, Devin.Doucette #jira UE-133497 #rnx #preflight 61f835491c5ac5523462810a - A lot of files have been touched but most of this is changing FPayload::IsValid to !FIoHash::IsZero, the main changes are in EditorBulkData/EditorBulkDataTests - The only difference between FPayloadId and FIoHash is that the former considered the hash of an invalid or empty buffer to be 'invalid' too where as FIoHash would return a valid hash -- To keep behaviour the same, we only hash payloads in EditorBulkData using a utility method ::HashBuffer which will not hash empty or invalid payloads and return a default FIoHash instead. -- Unit tests have been extended to prove that the behaviour has not changed. #ROBOMERGE-AUTHOR: paul.chipchase #ROBOMERGE-SOURCE: CL 18806362 in //UE5/Release-5.0/... via CL 18808527 via CL 18821790 #ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545) [CL 18822154 by paul chipchase in ue5-main branch]
63 lines
2.2 KiB
C++
63 lines
2.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "IVirtualizationBackend.h"
|
|
|
|
namespace UE::Virtualization
|
|
{
|
|
/**
|
|
* A basic backend based on the file system. This can be used to access/store virtualization
|
|
* data either on a local disk or a network share. It is intended to be used as a caching system
|
|
* to speed up operations (running a local cache or a shared cache for a site) rather than as the
|
|
* proper backend solution.
|
|
*
|
|
* Ini file setup:
|
|
* 'Name'=(Type=FileSystem, Path="XXX", RetryCount=X, RetryWaitTime=X)
|
|
*
|
|
* Required Values:
|
|
* 'Name': The backend name in the hierarchy.
|
|
* 'Type': The backend will be of type 'FFileSystemBackend'.
|
|
* 'Path': The root directory where the files are stored.
|
|
*
|
|
* Optional Values:
|
|
* RetryCount: How many times we should try to open a payload file for read before giving up with
|
|
* an error. Useful when many threads/processes can be pushing/pulling from the same
|
|
* path/ [Default=10]
|
|
* RetryWaitTime: The length of time the process should wait between each read attempt in milliseconds.
|
|
* Remember that the max length of time that the process can stall attempting to read
|
|
* a payload file is RetryCount * RetryWaitTime; [Default=100ms]
|
|
*/
|
|
class FFileSystemBackend final : public IVirtualizationBackend
|
|
{
|
|
public:
|
|
explicit FFileSystemBackend(FStringView ConfigName, FStringView DebugName);
|
|
virtual ~FFileSystemBackend() = 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:
|
|
|
|
void CreateFilePath(const FIoHash& PayloadId, FStringBuilderBase& OutPath);
|
|
|
|
TUniquePtr<FArchive> OpenFileForReading(const TCHAR* FilePath);
|
|
|
|
/** The root directory where the payload files should be located. */
|
|
FString RootDirectory;
|
|
|
|
/** The number of times to retry opening a payload file for read */
|
|
int32 RetryCount = 10;
|
|
/** The length of time (in milliseconds) to wait after each attempt before retrying. */
|
|
int32 RetryWaitTimeMS = 100;
|
|
};
|
|
|
|
} // namespace UE::Virtualization
|