Files
UnrealEngineUWP/Engine/Source/Developer/DerivedDataCache/Public/DerivedDataBuildJob.h
devin doucette bfda02d384 DDC: Replaced FRequest with FRequestGroup to handle nested and chained requests more robustly
Any function that may create a request now has a IRequestOwner& parameter, and uses the Begin and End functions on the owner to manage the lifetime of any requests that it creates, as well as using End to invoke the completion callback for any request which has one.

The new FRequestBarrier may be used to block a group from being considered complete in a scope where more requests may be added to it.

#rb Matt.Peters
#rnx
#preflight 6109b5c403d303000144cce5
#preflight 610acf7103d30300016fda94

#ROBOMERGE-SOURCE: CL 17060470 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v850-17047176)

[CL 17060649 by devin doucette in ue5-release-engine-test branch]
2021-08-04 18:08:50 -04:00

76 lines
2.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreTypes.h"
#include "Containers/StringFwd.h"
#include "DerivedDataRequest.h"
template <typename FuncType> class TUniqueFunction;
namespace UE::DerivedData { class FBuildOutput; }
namespace UE::DerivedData { class IBuild; }
namespace UE::DerivedData { class IBuildScheduler; }
namespace UE::DerivedData { class ICache; }
namespace UE::DerivedData { struct FBuildJobCompleteParams; }
namespace UE::DerivedData { struct FBuildActionKey; }
namespace UE::DerivedData { struct FBuildKey; }
namespace UE::DerivedData { struct FCacheKey; }
namespace UE::DerivedData { enum class EBuildPolicy : uint8; }
namespace UE::DerivedData { enum class EBuildStatus : uint32; }
namespace UE::DerivedData
{
using FOnBuildJobComplete = TUniqueFunction<void (FBuildJobCompleteParams&& Params)>;
/**
* A build job is responsible for the execution of one build.
*
* Jobs typically proceed through each one of a sequence of states, though a state may be skipped
* if the action was found in the cache or if the scheduler finds duplicate jobs for a definition
* or an action.
*
* The job depends on the build scheduler to move it through its states. That relationship allows
* the scheduler more control over resources such as: memory, compute, storage, network.
*/
class IBuildJob
{
public:
/** Returns the name by which to identify this job for logging and profiling. */
virtual FStringView GetName() const = 0;
/** Returns the name of the function to build with, or "Unknown" if not resolved yet. */
virtual FStringView GetFunction() const = 0;
/** Returns the cache associated with this job. */
virtual ICache& GetCache() const = 0;
/** Returns the build system associated with this job. */
virtual IBuild& GetBuild() const = 0;
/** Called by the scheduler to continue this job on the calling thread. */
virtual void Schedule() = 0;
/** Called by the scheduler to skip remote execution and fall back to local execution if permitted. */
virtual void SkipExecuteRemote() = 0;
/** Called by the scheduler if it has cached output compatible with the build policy. */
virtual void SetOutput(const FBuildOutput& Output) = 0;
};
/** Parameters for the completion callback for build jobs. */
struct FBuildJobCompleteParams
{
/** Job that is complete. */
const IBuildJob& Job;
/** Key for the job in the cache. Empty if the build completes before the key is assigned. */
const FCacheKey& CacheKey;
/** Output for the job that completed or was canceled. */
FBuildOutput&& Output;
/** Detailed status of the job. */
EBuildStatus BuildStatus{};
/** Basic status of the job. */
EStatus Status = EStatus::Error;
};
} // UE::DerivedData