Files
UnrealEngineUWP/Engine/Source/Developer/Virtualization/Private/VirtualizationSourceControlBackend.h
paul chipchase 9d14a794ea Give improved error messages to the user if the source control asset virtualization backend fails to connect.
#rb PJ.Kack
#jira UE-136612
#rnx
#preflight 61e589b7904123989a1817cc

- If a perforce connection issue is encountered when starting up the editor we will now print an error to the message log and then on the first tick of the editor display a notification to get the users attention. It will no longer result in a fatal error.

- Add a new category "Asset Virtualization" to the message log so that we can start to improve the feedback we give to end users rather than only reporting problems via UE_LOG. This also introduces a new localization text name space.
-- I will need to go over a lot of the virtualization modules error handling and move it to use the message log instead.
- When the source control backend first starts up we now specifically check if the connection works and if not try to give the user feedback on how to fix it.
-- Ideally we'd provide a  login dialog for the user to fix the problem in place but due to how early in the start up process we need to be able to access the virtualization backends this is quite tricky.
- In the future we will build the concept of a backends connection into a formalized concept in the system along with better error handling. At this point FSourceControlBackend::OnConnectionError should be moved to general use for all backends. this will allow us to provide much better status info to the user.

#ROBOMERGE-AUTHOR: paul.chipchase
#ROBOMERGE-SOURCE: CL 18637036 in //UE5/Release-5.0/... via CL 18637043 via CL 18637054
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v899-18417669)

[CL 18637614 by paul chipchase in ue5-main branch]
2022-01-18 04:50:38 -05:00

66 lines
2.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "IVirtualizationBackend.h"
#include "Containers/StringView.h"
namespace UE::Virtualization
{
/**
* This backend can be used to access payloads stored in source control.
* The backend doesn't 'check out' a payload file but instead will just download the payload as
* a binary blob.
* It is assumed that the files are stored with the same path convention as the file system
* backend, found in Utils::PayloadIdToPath.
*
* Ini file setup:
* 'Name'=(Type=SourceControl, DepotRoot="//XXX/")
* Where 'Name' is the backend name in the hierarchy and 'XXX' is the path in the source control
* depot where the payload files are being stored.
*
* Optional Values:
* UsePartitionedClient: When true the temporary workspace client created to submit payloads
* from will be created as a partitioned workspace which is less overhead
* on the source control server. If your server does not support this then
* use false. [Default=True]
*/
class FSourceControlBackend final : public IVirtualizationBackend
{
public:
explicit FSourceControlBackend(FStringView ConfigName, FStringView InDebugName);
virtual ~FSourceControlBackend() = default;
private:
/* IVirtualizationBackend implementation */
virtual bool Initialize(const FString& ConfigEntry) override;
virtual EPushResult PushData(const FPayloadId& Id, const FCompressedBuffer& Payload, const FString& Context) override;
virtual bool PushData(TArrayView<FPushRequest> Requests) override;
virtual FCompressedBuffer PullData(const FPayloadId& Id) override;
virtual bool DoesPayloadExist(const FPayloadId& Id) override;
virtual bool DoPayloadsExist(TArrayView<const FPayloadId> PayloadIds, TArray<bool>& OutResults) override;
private:
void CreateDepotPath(const FPayloadId& PayloadId, FStringBuilderBase& OutPath);
/** Will display a FMessage notification to the user on the next valid engine tick to try and keep them aware of connection failures */
void OnConnectionError();
/** The root where the virtualized payloads are stored in source control */
FString DepotRoot;
/** Should we try to make the temp client partitioned or not? */
bool bUsePartitionedClient = true;
};
} // namespace UE::Virtualization