2020-10-21 17:56:05 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2021-04-30 08:14:54 -04:00
|
|
|
#include "Compression/CompressedBuffer.h"
|
|
|
|
|
#include "HAL/CriticalSection.h"
|
2020-10-21 17:56:05 -04:00
|
|
|
#include "Logging/LogMacros.h"
|
2021-07-22 09:55:49 -04:00
|
|
|
#include "Templates/UniquePtr.h"
|
2022-11-02 06:56:10 -04:00
|
|
|
|
2023-01-11 14:28:01 -05:00
|
|
|
|
2021-10-25 20:05:28 -04:00
|
|
|
#include "Virtualization/VirtualizationSystem.h"
|
|
|
|
|
|
2022-04-25 08:14:36 -04:00
|
|
|
class IConsoleObject;
|
2022-04-21 03:15:13 -04:00
|
|
|
class FOutputDevice;
|
2023-01-11 14:28:01 -05:00
|
|
|
struct FAnalyticsEventAttribute;
|
2022-04-21 03:15:13 -04:00
|
|
|
|
2021-04-30 08:14:54 -04:00
|
|
|
/**
|
|
|
|
|
* Configuring the backend hierarchy
|
|
|
|
|
*
|
|
|
|
|
* The [Core.ContentVirtualization] section can contain a string 'BackendGraph' which will set with the name of
|
|
|
|
|
* the backend graph, if not set then the default 'ContentVirtualizationBackendGraph_None' will be used instead.
|
|
|
|
|
* This value can also be overridden from the command line by using 'BackendGraph=FooBar' where FooBar is the
|
|
|
|
|
* name of the graph.
|
|
|
|
|
*
|
|
|
|
|
* The first entry in the graph to be parsed will be the 'Hierarchy' which describes which backends should be
|
|
|
|
|
* mounted and in which order. For example 'Hierarchy=(Entry=Foo, Entry=Bar)' which should mount two backends
|
|
|
|
|
* 'Foo' and 'Bar' in that order.
|
|
|
|
|
*
|
|
|
|
|
* Each referenced backend in the hierarchy will then require it's own entry in the graph where the key will be
|
|
|
|
|
* it's name in the hierarchy and the value a string describing how to set it up.
|
|
|
|
|
* The value must contain 'Type=X' where X is the name used to find the correct IVirtualizationBackendFactory
|
|
|
|
|
* to create the backend with.
|
|
|
|
|
* Once the backend is created then reset of the string will be passed to it, so that additional customization
|
|
|
|
|
* can be extracted. Depending on the backend implementation these values may or may not be required.
|
|
|
|
|
*
|
|
|
|
|
* Example graph:
|
|
|
|
|
* [ContentVirtualizationBackendGraph_Example]
|
|
|
|
|
* Hierarchy=(Entry=MemoryCache, Entry=NetworkShare)
|
|
|
|
|
* MemoryCache=(Type=InMemory)
|
|
|
|
|
* NetworkShare=(Type=FileSystem, Path="\\path\to\somewhere")
|
|
|
|
|
*
|
|
|
|
|
* The graph is named 'ContentVirtualizationBackendGraph_Example'.
|
|
|
|
|
* The hierarchy contains two entries 'InMemory' and 'NetworkShare' to be mounted in that order
|
|
|
|
|
* MemoryCache creates a backend of type 'InMemory' and has no additional customization
|
|
|
|
|
* NetworkShare creates a backend of type 'FileSystem' and provides an additional path, the filesystem backend would
|
|
|
|
|
* fatal error without this value.
|
|
|
|
|
*/
|
|
|
|
|
|
2021-11-07 23:43:01 -05:00
|
|
|
/**
|
|
|
|
|
* Filtering
|
|
|
|
|
*
|
2023-03-08 08:06:42 -05:00
|
|
|
* By default all packages in a project can be virtualized once the system has been enabled. The can be
|
|
|
|
|
* overridden by the filtering system, either by excluding specific packages/directories, or by changing
|
|
|
|
|
* the default so that no package will be virtualized except packages/directories that have been
|
|
|
|
|
* specifically marked as to be virtualized.
|
|
|
|
|
*
|
|
|
|
|
* Note that the filtering is applied when a package is saved and stored as meta data in the FPackageTrailer.
|
|
|
|
|
* This means that you can scan your package files and reason about the behavior of the payloads but also
|
|
|
|
|
* means that if you change your project filtering rules that packages have to be re-saved in order for the
|
|
|
|
|
* filtering to be applied.
|
|
|
|
|
*
|
2022-02-16 01:27:09 -05:00
|
|
|
* @see ShouldVirtualizePackage or ShouldVirtualize for implementation details.
|
2021-11-07 23:43:01 -05:00
|
|
|
*
|
|
|
|
|
* Basic Setup:
|
|
|
|
|
*
|
2023-02-15 10:32:09 -05:00
|
|
|
* [Core.VirtualizationModule]
|
2023-03-08 08:06:42 -05:00
|
|
|
* FilterMode=OptIn/OptOut The general mode to be applied to all packages. With 'OptIn' packages will
|
|
|
|
|
* not be virtualized unless their path is included via VirtualizationFilterSettings.
|
|
|
|
|
* With 'OptOut' all packages will be virtualized unless excluded via
|
|
|
|
|
* VirtualizationFilterSettings [Default=OptOut]
|
|
|
|
|
* FilterMapContent=True/False When true any payload stored in a .umap or _BuildData.uasset file will be
|
|
|
|
|
* excluded from virtualization [Default=true]
|
2021-11-07 23:43:01 -05:00
|
|
|
*
|
|
|
|
|
* PackagePath Setup:
|
|
|
|
|
*
|
2022-02-16 01:27:09 -05:00
|
|
|
* In addition to the default filtering mode set above, payloads stored in packages can be filtered based on the
|
|
|
|
|
* package path. This allows a package to be including in the virtualization process or excluded from it.
|
|
|
|
|
*
|
2021-11-07 23:43:01 -05:00
|
|
|
* Note that these paths will be stored in the ini files under the Saved directory. To remove a path make sure to
|
|
|
|
|
* use the - syntax to remove the entry from the array, rather than removing the line itself. Otherwise it will
|
|
|
|
|
* persist until the saved config file has been reset.
|
|
|
|
|
*
|
|
|
|
|
* [/Script/Virtualization.VirtualizationFilterSettings]
|
2022-02-16 01:27:09 -05:00
|
|
|
* +ExcludePackagePaths="/MountPoint/PathToExclude/" Excludes any package found under '/MountPoint/PathToExclude/' from the virtualization process
|
|
|
|
|
* +ExcludePackagePaths="/MountPoint/PathTo/ThePackageToExclude" Excludes the specific package '/MountPoint/PathTo/ThePackageToExclude' from the virtualization process
|
|
|
|
|
* +IncludePackagePaths="/MountPoint/PathToInclude/" Includes any package found under '/MountPoint/PathToInclude/' in the virtualization process
|
|
|
|
|
* +IncludePackagePaths="/MountPoint/PathTo/ThePackageToInclude" Includes the specific package '/MountPoint/PathTo/ThePackageToInclude' in the virtualization process
|
2021-11-07 23:43:01 -05:00
|
|
|
*/
|
|
|
|
|
|
2023-02-15 10:32:09 -05:00
|
|
|
/*
|
|
|
|
|
* FVirtualizationManager
|
|
|
|
|
*
|
|
|
|
|
* Ini file setup:
|
|
|
|
|
*
|
|
|
|
|
* EnablePayloadVirtualization [bool]: When true the virtualization process will be enabled (usually when a package is submitted
|
|
|
|
|
to revision control. [Default=true]
|
|
|
|
|
* EnableCacheOnPull [bool]: When true payloads will be pushed to cached storage after being pulled from persistent
|
|
|
|
|
* storage. [Default=true]
|
|
|
|
|
* EnableCacheOnPush [bool]: When true payloads will be pushed to cached storage right before being pushed to persistent
|
|
|
|
|
* storage. [Default=true]
|
|
|
|
|
* MinPayloadLength [int64]: The minimum length (in bytes) that a payload must reach before it can be considered for
|
|
|
|
|
* virtualization. Use this to strike a balance between disk space and the number of smaller
|
|
|
|
|
payloads in your project being virtualized. [Default=0]
|
|
|
|
|
* BackendGraph [string]: The name of the backend graph to use. The default graph has no backends and effectively
|
|
|
|
|
disables the system. It is expected that a project will define the graph that it wants
|
|
|
|
|
and then set this option [Default=ContentVirtualizationBackendGraph_None]
|
|
|
|
|
* VirtualizationProcessTag [string]: The tag to be applied to any set of packages that have had the virtualization process run
|
|
|
|
|
* on them. Typically this means appending the tag to the description of a changelist of
|
|
|
|
|
* packages. This value can be set to an empty string. [Default="#virtualized"]
|
|
|
|
|
* AllowSubmitIfVirtualizationFailed [bool]: Revision control submits that trigger the virtualization system can either allow or block
|
|
|
|
|
* the submit if the virtualization process fails based on this value. True will allow a
|
|
|
|
|
* submit with an error to continue and false will block the submit. Note that by error we mean
|
|
|
|
|
* that the packages were not virtualized, not that bad data was produced. [Default=false]
|
|
|
|
|
* LazyInitConnections [bool]: When true, backends will not attempt to connect to their services until actually required.
|
|
|
|
|
* This can remove lengthy connection steps from the process init phase and then only connect
|
|
|
|
|
* if we actually need that service. Note that if this is true then the connection can come from
|
|
|
|
|
* any thread, so custom backend code will need to take that into account. [Default=false]
|
|
|
|
|
*/
|
|
|
|
|
|
2021-04-30 08:14:54 -04:00
|
|
|
namespace UE::Virtualization
|
|
|
|
|
{
|
|
|
|
|
class IVirtualizationBackend;
|
|
|
|
|
class IVirtualizationBackendFactory;
|
2022-10-21 22:27:40 -04:00
|
|
|
class FPullRequestCollection;
|
2021-04-30 08:14:54 -04:00
|
|
|
|
2022-02-16 01:27:09 -05:00
|
|
|
/** The default mode of filtering to use with package paths that do not match entries in UVirtualizationFilterSettings */
|
|
|
|
|
enum class EPackageFilterMode : uint8
|
|
|
|
|
{
|
|
|
|
|
/** Packages will be virtualized by default and must be opted out by the use of UVirtualizationFilterSettings::ExcludePackagePaths */
|
2022-07-21 08:31:47 -04:00
|
|
|
OptOut = 0,
|
2022-02-16 01:27:09 -05:00
|
|
|
/** Packages will not be virtualized by default and must be opted in by the user of UVirtualizationFilterSettings::IncludePackagePaths */
|
|
|
|
|
OptIn
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** Attempt to convert a string buffer to EPackageFilterMode */
|
|
|
|
|
bool LexTryParseString(EPackageFilterMode& OutValue, FStringView Buffer);
|
|
|
|
|
|
2020-10-21 17:56:05 -04:00
|
|
|
/** This is used as a wrapper around the various potential back end implementations.
|
|
|
|
|
The calling code shouldn't need to care about which back ends are actually in use. */
|
2021-12-02 04:41:46 -05:00
|
|
|
class FVirtualizationManager final : public IVirtualizationSystem
|
2020-10-21 17:56:05 -04:00
|
|
|
{
|
|
|
|
|
public:
|
2021-07-22 09:55:49 -04:00
|
|
|
using FRegistedFactories = TMap<FName, IVirtualizationBackendFactory*>;
|
|
|
|
|
using FBackendArray = TArray<IVirtualizationBackend*>;
|
|
|
|
|
|
2020-10-21 17:56:05 -04:00
|
|
|
FVirtualizationManager();
|
2021-10-25 20:05:28 -04:00
|
|
|
virtual ~FVirtualizationManager();
|
2020-10-21 17:56:05 -04:00
|
|
|
|
2021-12-02 04:41:46 -05:00
|
|
|
private:
|
|
|
|
|
/* IVirtualizationSystem implementation */
|
|
|
|
|
|
2022-03-08 11:22:45 -05:00
|
|
|
virtual bool Initialize(const FInitParams& InitParams) override;
|
2022-03-07 05:42:57 -05:00
|
|
|
|
2021-10-25 20:05:28 -04:00
|
|
|
virtual bool IsEnabled() const override;
|
2022-01-28 03:48:55 -05:00
|
|
|
virtual bool IsPushingEnabled(EStorageType StorageType) const override;
|
2022-05-17 07:54:28 -04:00
|
|
|
|
2022-08-09 07:51:55 -04:00
|
|
|
virtual EPayloadFilterReason FilterPayload(const UObject* Owner) const override;
|
2022-07-21 08:31:47 -04:00
|
|
|
|
|
|
|
|
virtual bool AllowSubmitIfVirtualizationFailed() const override;
|
2021-07-22 09:55:49 -04:00
|
|
|
|
2021-12-08 02:19:42 -05:00
|
|
|
virtual bool PushData(TArrayView<FPushRequest> Requests, EStorageType StorageType) override;
|
2022-10-21 22:27:40 -04:00
|
|
|
virtual bool PullData(TArrayView<FPullRequest> Requests) override;
|
2020-10-21 17:56:05 -04:00
|
|
|
|
2022-06-15 10:37:52 -04:00
|
|
|
virtual EQueryResult QueryPayloadStatuses(TArrayView<const FIoHash> Ids, EStorageType StorageType, TArray<EPayloadStatus>& OutStatuses) override;
|
2021-12-01 11:13:31 -05:00
|
|
|
|
2023-01-10 09:15:11 -05:00
|
|
|
virtual FVirtualizationResult TryVirtualizePackages(TConstArrayView<FString> PackagePaths, EVirtualizationOptions Options) override;
|
2022-10-13 16:28:28 -04:00
|
|
|
|
2023-01-10 09:15:11 -05:00
|
|
|
virtual FRehydrationResult TryRehydratePackages(TConstArrayView<FString> PackagePaths, ERehydrationOptions Options) override;
|
2022-10-13 16:28:28 -04:00
|
|
|
virtual ERehydrationResult TryRehydratePackages(TConstArrayView<FString> PackagePaths, uint64 PaddingAlignment, TArray<FText>& OutErrors, TArray<FSharedBuffer>& OutPackages, TArray<FRehydrationInfo>* OutInfo) override;
|
2022-03-23 11:14:47 -04:00
|
|
|
|
2022-06-17 04:02:32 -04:00
|
|
|
virtual void DumpStats() const override;
|
|
|
|
|
|
2021-11-18 14:37:34 -05:00
|
|
|
virtual FPayloadActivityInfo GetAccumualtedPayloadActivityInfo() const override;
|
2021-06-03 04:35:17 -04:00
|
|
|
|
2021-11-18 14:37:34 -05:00
|
|
|
virtual void GetPayloadActivityInfo( GetPayloadActivityInfoFuncRef ) const override;
|
2021-11-23 15:05:13 -05:00
|
|
|
|
2023-01-11 14:28:01 -05:00
|
|
|
virtual void GatherAnalytics(TArray<FAnalyticsEventAttribute>& Attributes) const override;
|
|
|
|
|
|
2021-11-23 15:05:13 -05:00
|
|
|
virtual FOnNotification& GetNotificationEvent() override
|
|
|
|
|
{
|
|
|
|
|
return NotificationEvent;
|
|
|
|
|
}
|
2021-11-18 14:37:34 -05:00
|
|
|
|
2020-10-21 17:56:05 -04:00
|
|
|
private:
|
2021-12-02 04:41:46 -05:00
|
|
|
|
2022-03-07 05:42:57 -05:00
|
|
|
void ApplySettingsFromConfigFiles(const FConfigFile& ConfigFile);
|
Add a number of ways for the VA backend connections to be changed to lazy initialize on first use.
#rb Devin.Doucette
#jira UE-161599
#rnx
#preflight 6303c8d65a5d4e4624e7bf52
- There are some use cases that require the VA system to be initialized and configured correctly but would prefer that the backend connections only run if absolutely needed (usually when a payload is pulled or pushed for the first time), this change provides four different ways of doing this:
-- Setting [Core.VirtualizationModule]LazyInitConnections=true in the Engine ini file
-- Setting the define 'UE_VIRTUALIZATION_CONNECTION_LAZY_INIT' to 1 in a programs .target.cs
-- Running with the commandline option -VA-LazyInitConnections
-- Setting the cvar 'VA.LazyInitConnections' to 1 (only works if it is set before the VA system is initialized, changing it mid editor via the console does nothing)
--- Note that after the config file, each setting there only opts into lazy initializing the connections, setting the cvar to 0 for example will not prevent the cmdline from opting in etc.
- In the future we will allow the connection code to run async, so the latency can be hidden behind the editor loading, but for the current use case we are taking the minimal approach.
-- This means we only support the backend being in 3 states. No connection has been made yet, the connection is broken and the connection is working.
-- To keep things simple we only record if we have attempted to connect the backends or not. We don't check individual backends nor do we try to reconnect failed ones etc. This is all scheduled for a future work item.
- If the connections are not initialized when the VA system is, we wait until the first time someone calls one of the virtualization methods that will actually use a connection: Push/Pull/Query
-- We try connecting all of the backends at once, even if they won't be used in the call to keep things simple.
- Only the source control backend makes use of the connection system. The horde storage (http) backend could take advantage too, but it is currently unused and most likely going to just be deleted so there seemed little point updating it.
- If we try to run an operation on an unconnected backend we only log to verbose. This is to maintain existing behaviour where a failed backend would not be mounted at all. This logging will likely be revisited in a future work item.
[CL 21511855 by paul chipchase in ue5-main branch]
2022-08-23 13:01:15 -04:00
|
|
|
void ApplySettingsFromFromCmdline();
|
|
|
|
|
void ApplySettingsFromCVar();
|
|
|
|
|
|
2021-11-18 14:37:34 -05:00
|
|
|
void ApplyDebugSettingsFromFromCmdline();
|
2021-04-30 08:14:54 -04:00
|
|
|
|
2022-04-25 02:24:53 -04:00
|
|
|
void RegisterConsoleCommands();
|
|
|
|
|
|
|
|
|
|
void OnUpdateDebugMissBackendsFromConsole(const TArray<FString>& Args, FOutputDevice& OutputDevice);
|
|
|
|
|
void OnUpdateDebugMissChanceFromConsole(const TArray<FString>& Args, FOutputDevice& OutputDevice);
|
|
|
|
|
void OnUpdateDebugMissCountFromConsole(const TArray<FString>& Args, FOutputDevice& OutputDevice);
|
2022-04-21 03:15:13 -04:00
|
|
|
void UpdateBackendDebugState();
|
2022-04-22 07:26:04 -04:00
|
|
|
|
2022-04-21 03:15:13 -04:00
|
|
|
bool ShouldDebugDisablePulling(FStringView BackendConfigName) const;
|
2022-04-25 02:24:53 -04:00
|
|
|
bool ShouldDebugFailPulling();
|
2022-04-21 03:15:13 -04:00
|
|
|
|
2022-03-07 05:42:57 -05:00
|
|
|
void MountBackends(const FConfigFile& ConfigFile);
|
2022-08-11 05:51:29 -04:00
|
|
|
void ParseHierarchy(const FConfigFile& ConfigFile, const TCHAR* GraphName, const TCHAR* HierarchyKey, const TCHAR* LegacyHierarchyKey, const FRegistedFactories& FactoryLookupTable, FBackendArray& PushArray);
|
2022-03-07 05:42:57 -05:00
|
|
|
bool CreateBackend(const FConfigFile& ConfigFile, const TCHAR* GraphName, const FString& ConfigEntryName, const FRegistedFactories& FactoryLookupTable, FBackendArray& PushArray);
|
2021-04-30 08:14:54 -04:00
|
|
|
|
2021-07-22 09:55:49 -04:00
|
|
|
void AddBackend(TUniquePtr<IVirtualizationBackend> Backend, FBackendArray& PushArray);
|
2020-10-21 17:56:05 -04:00
|
|
|
|
Add a number of ways for the VA backend connections to be changed to lazy initialize on first use.
#rb Devin.Doucette
#jira UE-161599
#rnx
#preflight 6303c8d65a5d4e4624e7bf52
- There are some use cases that require the VA system to be initialized and configured correctly but would prefer that the backend connections only run if absolutely needed (usually when a payload is pulled or pushed for the first time), this change provides four different ways of doing this:
-- Setting [Core.VirtualizationModule]LazyInitConnections=true in the Engine ini file
-- Setting the define 'UE_VIRTUALIZATION_CONNECTION_LAZY_INIT' to 1 in a programs .target.cs
-- Running with the commandline option -VA-LazyInitConnections
-- Setting the cvar 'VA.LazyInitConnections' to 1 (only works if it is set before the VA system is initialized, changing it mid editor via the console does nothing)
--- Note that after the config file, each setting there only opts into lazy initializing the connections, setting the cvar to 0 for example will not prevent the cmdline from opting in etc.
- In the future we will allow the connection code to run async, so the latency can be hidden behind the editor loading, but for the current use case we are taking the minimal approach.
-- This means we only support the backend being in 3 states. No connection has been made yet, the connection is broken and the connection is working.
-- To keep things simple we only record if we have attempted to connect the backends or not. We don't check individual backends nor do we try to reconnect failed ones etc. This is all scheduled for a future work item.
- If the connections are not initialized when the VA system is, we wait until the first time someone calls one of the virtualization methods that will actually use a connection: Push/Pull/Query
-- We try connecting all of the backends at once, even if they won't be used in the call to keep things simple.
- Only the source control backend makes use of the connection system. The horde storage (http) backend could take advantage too, but it is currently unused and most likely going to just be deleted so there seemed little point updating it.
- If we try to run an operation on an unconnected backend we only log to verbose. This is to maintain existing behaviour where a failed backend would not be mounted at all. This logging will likely be revisited in a future work item.
[CL 21511855 by paul chipchase in ue5-main branch]
2022-08-23 13:01:15 -04:00
|
|
|
void EnsureBackendConnections();
|
|
|
|
|
|
2022-10-21 22:27:40 -04:00
|
|
|
void CachePayloads(TArrayView<FPushRequest> Requests, const IVirtualizationBackend* BackendSource);
|
2021-07-22 09:55:49 -04:00
|
|
|
|
2022-10-21 22:27:40 -04:00
|
|
|
bool TryCacheDataToBackend(IVirtualizationBackend& Backend, TArrayView<FPushRequest> Requests);
|
2021-12-08 02:19:42 -05:00
|
|
|
bool TryPushDataToBackend(IVirtualizationBackend& Backend, TArrayView<FPushRequest> Requests);
|
|
|
|
|
|
2022-10-21 22:27:40 -04:00
|
|
|
void PullDataFromAllBackends(TArrayView<FPullRequest> Requests);
|
|
|
|
|
void PullDataFromBackend(IVirtualizationBackend& Backend, TArrayView<FPullRequest> Requests);
|
2023-01-11 14:28:01 -05:00
|
|
|
|
2022-08-09 07:51:55 -04:00
|
|
|
bool ShouldVirtualizeAsset(const UObject* Owner) const;
|
|
|
|
|
|
2021-11-07 23:43:01 -05:00
|
|
|
/**
|
2022-02-16 01:27:09 -05:00
|
|
|
* Determines if a package path should be virtualized or not based on any exclusion/inclusion patterns
|
|
|
|
|
* that might have been set in UVirtualizationFilterSettings.
|
|
|
|
|
* If the path does not match any pattern set in UVirtualizationFilterSettings then use the default
|
|
|
|
|
* FilterMode to determine if the payload should be virtualized or not.
|
2021-11-07 23:43:01 -05:00
|
|
|
*
|
|
|
|
|
* @param PackagePath The path of the package to check. This can be empty which would indicate that
|
|
|
|
|
* a payload is not owned by a specific package.
|
|
|
|
|
* @return True if the package should be virtualized and false if the package path is
|
|
|
|
|
* excluded by the projects current filter set up.
|
|
|
|
|
*/
|
|
|
|
|
bool ShouldVirtualizePackage(const FPackagePath& PackagePath) const;
|
2022-02-16 01:27:09 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determines if a package should be virtualized or not based on the given content.
|
|
|
|
|
* If the context can be turned into a package path then ::ShouldVirtualizePackage
|
|
|
|
|
* will be used instead.
|
|
|
|
|
* If the context is not a package path then we use the default FilterMode to determine
|
|
|
|
|
* if the payload should be virtualized or not.
|
|
|
|
|
*
|
|
|
|
|
* @return True if the context should be virtualized and false if not.
|
|
|
|
|
*/
|
|
|
|
|
bool ShouldVirtualize(const FString& Context) const;
|
|
|
|
|
|
|
|
|
|
/** Determines if the default filtering behavior is to virtualize a payload or not */
|
|
|
|
|
bool ShouldVirtualizeAsDefault() const;
|
2022-10-21 22:27:40 -04:00
|
|
|
|
|
|
|
|
void BroadcastEvent(TConstArrayView<FPullRequest> Ids, ENotification Event);
|
2021-11-07 23:43:01 -05:00
|
|
|
|
2022-07-21 06:38:06 -04:00
|
|
|
private:
|
|
|
|
|
// The following members are set from the config file
|
|
|
|
|
|
2022-09-22 18:02:50 -04:00
|
|
|
/** Are packages allowed to be virtualized when submitted to source control. Defaults to true. */
|
|
|
|
|
bool bAllowPackageVirtualization;
|
2020-10-21 17:56:05 -04:00
|
|
|
|
2023-02-15 10:32:09 -05:00
|
|
|
enum ECachingPolicy
|
|
|
|
|
{
|
|
|
|
|
/** Never push payloads to cached storage */
|
|
|
|
|
None = 0,
|
|
|
|
|
/** Cache payloads after they have been pulled from persistent storage */
|
|
|
|
|
CacheOnPull = 1 << 0,
|
|
|
|
|
/** Cache payloads right before they are pushed to persistent storage */
|
|
|
|
|
CacheOnPush = 1 << 1,
|
|
|
|
|
|
|
|
|
|
AlwaysCache = CacheOnPull | CacheOnPush
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FRIEND_ENUM_CLASS_FLAGS(ECachingPolicy);
|
|
|
|
|
|
|
|
|
|
/** A bitfield describing when we push payloads to cached storage. */
|
|
|
|
|
ECachingPolicy CachingPolicy;
|
2021-08-04 03:25:25 -04:00
|
|
|
|
2020-10-21 17:56:05 -04:00
|
|
|
/** The minimum length for a payload to be considered for virtualization. Defaults to 0 bytes. */
|
|
|
|
|
int64 MinPayloadLength;
|
2021-04-30 08:14:54 -04:00
|
|
|
|
|
|
|
|
/** The name of the backend graph to load from the config ini file that will describe the backend hierarchy */
|
|
|
|
|
FString BackendGraphName;
|
|
|
|
|
|
2022-07-22 03:58:27 -04:00
|
|
|
/** The tag that will be returned when the virtualization process has run, commonly used to post fix changelist descriptions */
|
|
|
|
|
FString VirtualizationProcessTag;
|
|
|
|
|
|
2022-02-16 01:27:09 -05:00
|
|
|
/** The default filtering mode to apply if a payload is not matched with an option in UVirtualizationFilterSettings */
|
2022-07-21 06:38:06 -04:00
|
|
|
EPackageFilterMode FilteringMode;
|
2022-02-16 01:27:09 -05:00
|
|
|
|
2022-08-09 07:51:55 -04:00
|
|
|
/** Should payloads in .umap files (or associated _BuildData files) be filtered out and never virtualized */
|
|
|
|
|
bool bFilterMapContent;
|
|
|
|
|
|
2022-07-21 08:31:47 -04:00
|
|
|
/** Should file submits be allowed to continue if a call to TryVirtualizePackages fails */
|
|
|
|
|
bool bAllowSubmitIfVirtualizationFailed;
|
2021-04-30 08:14:54 -04:00
|
|
|
|
Add a number of ways for the VA backend connections to be changed to lazy initialize on first use.
#rb Devin.Doucette
#jira UE-161599
#rnx
#preflight 6303c8d65a5d4e4624e7bf52
- There are some use cases that require the VA system to be initialized and configured correctly but would prefer that the backend connections only run if absolutely needed (usually when a payload is pulled or pushed for the first time), this change provides four different ways of doing this:
-- Setting [Core.VirtualizationModule]LazyInitConnections=true in the Engine ini file
-- Setting the define 'UE_VIRTUALIZATION_CONNECTION_LAZY_INIT' to 1 in a programs .target.cs
-- Running with the commandline option -VA-LazyInitConnections
-- Setting the cvar 'VA.LazyInitConnections' to 1 (only works if it is set before the VA system is initialized, changing it mid editor via the console does nothing)
--- Note that after the config file, each setting there only opts into lazy initializing the connections, setting the cvar to 0 for example will not prevent the cmdline from opting in etc.
- In the future we will allow the connection code to run async, so the latency can be hidden behind the editor loading, but for the current use case we are taking the minimal approach.
-- This means we only support the backend being in 3 states. No connection has been made yet, the connection is broken and the connection is working.
-- To keep things simple we only record if we have attempted to connect the backends or not. We don't check individual backends nor do we try to reconnect failed ones etc. This is all scheduled for a future work item.
- If the connections are not initialized when the VA system is, we wait until the first time someone calls one of the virtualization methods that will actually use a connection: Push/Pull/Query
-- We try connecting all of the backends at once, even if they won't be used in the call to keep things simple.
- Only the source control backend makes use of the connection system. The horde storage (http) backend could take advantage too, but it is currently unused and most likely going to just be deleted so there seemed little point updating it.
- If we try to run an operation on an unconnected backend we only log to verbose. This is to maintain existing behaviour where a failed backend would not be mounted at all. This logging will likely be revisited in a future work item.
[CL 21511855 by paul chipchase in ue5-main branch]
2022-08-23 13:01:15 -04:00
|
|
|
/** Should backends defer connecting to their services until first use */
|
|
|
|
|
bool bLazyInitConnections;
|
|
|
|
|
|
2022-07-21 06:38:06 -04:00
|
|
|
private:
|
|
|
|
|
|
2022-03-08 11:22:45 -05:00
|
|
|
/** The name of the current project */
|
|
|
|
|
FString ProjectName;
|
|
|
|
|
|
2022-05-17 07:54:28 -04:00
|
|
|
/** The names of all asset types that should not virtualize. See @IsDisabledForObject */
|
|
|
|
|
TSet<FName> DisabledAssetTypes;
|
|
|
|
|
|
2021-07-22 09:55:49 -04:00
|
|
|
/** All of the backends that were mounted during graph creation */
|
|
|
|
|
TArray<TUniquePtr<IVirtualizationBackend>> AllBackends;
|
2021-04-30 08:14:54 -04:00
|
|
|
|
2021-07-22 09:55:49 -04:00
|
|
|
/** Backends used for caching operations (must support push operations). */
|
2022-08-11 05:51:29 -04:00
|
|
|
FBackendArray CacheStorageBackends;
|
2021-04-30 08:14:54 -04:00
|
|
|
|
2021-07-22 09:55:49 -04:00
|
|
|
/** Backends used for persistent storage operations (must support push operations). */
|
|
|
|
|
FBackendArray PersistentStorageBackends;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The hierarchy of backends to pull from, this is assumed to be ordered from fastest to slowest
|
|
|
|
|
* and can contain a mixture of local cacheable and persistent backends
|
|
|
|
|
*/
|
|
|
|
|
FBackendArray PullEnabledBackends;
|
2021-11-23 15:05:13 -05:00
|
|
|
|
Add a number of ways for the VA backend connections to be changed to lazy initialize on first use.
#rb Devin.Doucette
#jira UE-161599
#rnx
#preflight 6303c8d65a5d4e4624e7bf52
- There are some use cases that require the VA system to be initialized and configured correctly but would prefer that the backend connections only run if absolutely needed (usually when a payload is pulled or pushed for the first time), this change provides four different ways of doing this:
-- Setting [Core.VirtualizationModule]LazyInitConnections=true in the Engine ini file
-- Setting the define 'UE_VIRTUALIZATION_CONNECTION_LAZY_INIT' to 1 in a programs .target.cs
-- Running with the commandline option -VA-LazyInitConnections
-- Setting the cvar 'VA.LazyInitConnections' to 1 (only works if it is set before the VA system is initialized, changing it mid editor via the console does nothing)
--- Note that after the config file, each setting there only opts into lazy initializing the connections, setting the cvar to 0 for example will not prevent the cmdline from opting in etc.
- In the future we will allow the connection code to run async, so the latency can be hidden behind the editor loading, but for the current use case we are taking the minimal approach.
-- This means we only support the backend being in 3 states. No connection has been made yet, the connection is broken and the connection is working.
-- To keep things simple we only record if we have attempted to connect the backends or not. We don't check individual backends nor do we try to reconnect failed ones etc. This is all scheduled for a future work item.
- If the connections are not initialized when the VA system is, we wait until the first time someone calls one of the virtualization methods that will actually use a connection: Push/Pull/Query
-- We try connecting all of the backends at once, even if they won't be used in the call to keep things simple.
- Only the source control backend makes use of the connection system. The horde storage (http) backend could take advantage too, but it is currently unused and most likely going to just be deleted so there seemed little point updating it.
- If we try to run an operation on an unconnected backend we only log to verbose. This is to maintain existing behaviour where a failed backend would not be mounted at all. This logging will likely be revisited in a future work item.
[CL 21511855 by paul chipchase in ue5-main branch]
2022-08-23 13:01:15 -04:00
|
|
|
/** Do we have backends that have not yet tried connecting to their services */
|
|
|
|
|
bool bPendingBackendConnections;
|
|
|
|
|
|
2021-11-23 15:05:13 -05:00
|
|
|
/** Our notification Event */
|
|
|
|
|
FOnNotification NotificationEvent;
|
2022-04-21 03:15:13 -04:00
|
|
|
|
|
|
|
|
// Members after this point at used for debugging operations only!
|
|
|
|
|
|
2022-04-25 02:24:53 -04:00
|
|
|
struct FDebugValues
|
|
|
|
|
{
|
2022-04-25 08:14:36 -04:00
|
|
|
/** All of the console commands/variables that we register, so they can be unregistered when the manager is destroyed */
|
|
|
|
|
TArray<IConsoleObject*> ConsoleObjects;
|
|
|
|
|
|
2022-10-03 20:36:09 -04:00
|
|
|
/**
|
|
|
|
|
* Contains all of the delegate handles that we have bound to IConsoleVariable::OnChangedDelegate and need to be removed
|
|
|
|
|
* before it is safe to destroy the manager. Most likely due to having bound a lambda to the delegate that captured the
|
|
|
|
|
* FVirtualizationManager this pointer.
|
|
|
|
|
*/
|
|
|
|
|
TArray<TPair<IConsoleVariable*, FDelegateHandle>> ConsoleDelegateHandles;
|
|
|
|
|
|
2022-05-09 03:53:57 -04:00
|
|
|
/** The critical section used to force single threaded access if bForceSingleThreaded is true */
|
|
|
|
|
FCriticalSection ForceSingleThreadedCS;
|
|
|
|
|
|
2022-04-25 08:14:36 -04:00
|
|
|
/** When enabled all public operations will be performed as single threaded */
|
|
|
|
|
bool bSingleThreaded = false;
|
2022-04-22 07:26:04 -04:00
|
|
|
|
2022-04-26 13:20:05 -04:00
|
|
|
/**
|
|
|
|
|
* When enabled we will immediately 'pull' each payload after it has been pushed to either local or persistent
|
|
|
|
|
* storage and compare it to the original payload source to make sure that it was uploaded correctly
|
|
|
|
|
*/
|
|
|
|
|
bool bValidateAfterPush = false;
|
|
|
|
|
|
2022-04-25 02:24:53 -04:00
|
|
|
/** Array of backend names that should have their pull operation disabled */
|
|
|
|
|
TArray<FString> MissBackends;
|
|
|
|
|
|
|
|
|
|
/** The chance that a payload pull can just 'fail' to allow for testing */
|
|
|
|
|
float MissChance;
|
|
|
|
|
|
|
|
|
|
/** The number of upcoming payload pulls that should be failed */
|
|
|
|
|
std::atomic<int32> MissCount = 0;
|
|
|
|
|
} DebugValues;
|
2020-10-21 17:56:05 -04:00
|
|
|
};
|
2021-04-30 08:14:54 -04:00
|
|
|
|
|
|
|
|
} // namespace UE::Virtualization
|