Navigation
API > API/Runtime > API/Runtime/Core
A read-only archive that adds support for asynchronous preloading and priming to an inner archive.
This class supports two mutually-exclusive modes: PreloadBytes: An asynchronous inner archive is opened using the passed-in CreateAsyncArchive function; this call is made asynchronously on a TaskGraph thread. The size is read during initialization. After initialization, when StartPreload is called, an array of bytes equal in size to the inner archive's size is allocated, and an asynchronous ReadRequest is sent to the IAsyncReadFileHandle to read the first
Activate this mode by passing an FCreateArchive to InitializeAsync. PreloadHandle: A synchronous inner archive is opened using the passed-in CreateArchive function; this call is made asynchronously on a TaskGraph thread. Optionally, a precache request is sent to the inner archive for the first
Activate this mode by passing an FCreateAsyncArchive and (optionally, for the precache request) Flags::Prime to InitializeAsync.
This class is not threadsafe. The public interface can be used at the same time as internal asynchronous tasks are executing, but the public interface can not be used from multiple threads at once.
| Name | FPreloadableArchive |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Misc/PreloadableFile.h |
| Include Path | #include "Misc/PreloadableFile.h" |
Syntax
class FPreloadableArchive : public FArchive
Inheritance Hierarchy
- FArchiveState → FArchive → FPreloadableArchive
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FPreloadableArchive
(
FStringView ArchiveName |
Misc/PreloadableFile.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~FPreloadableArchive() |
Misc/PreloadableFile.h |
Structs
| Name | Remarks |
|---|---|
| FSavedReadCompleteArguments | Saved values from the inline OnReadComplete call |
Enums
Public
| Name | Remarks |
|---|---|
| Flags | |
| FPreloadableArchive |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FCreateArchive | TUniqueFunction< FArchive *()> | Misc/PreloadableFile.h | |
| FCreateAsyncArchive | TUniqueFunction< IAsyncReadFileHandle *()> | Misc/PreloadableFile.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool AllocateCache () |
When in PreloadBytes mode, allocate if necessary the memory for the preloaded bytes. | Misc/PreloadableFile.h | |
FArchive * DetachLowerLevel () |
Return the LowerLevel FArchive if it has been allocated. | Misc/PreloadableFile.h | |
bool HasValidData () |
Return whether this archive has an inner archive it can provide data out of. | Misc/PreloadableFile.h | |
void InitializeAsync
(
FCreateArchive&& InCreateArchiveFunction, |
Initialize the FPreloadableFile asynchronously, performing FileOpen operations on another thread. | Misc/PreloadableFile.h | |
void InitializeAsync
(
FCreateAsyncArchive&& InCreateAsyncArchiveFunction, |
Misc/PreloadableFile.h | ||
bool IsCacheAllocated() |
Return whether the cache is currently allocated. | Misc/PreloadableFile.h | |
bool IsInitialized () |
Return whether InitializeAsync has completed. | Misc/PreloadableFile.h | |
bool IsPreloading () |
Return whether preloading is in progress. | Misc/PreloadableFile.h | |
void ReleaseCache() |
Free all memory used by the cache or for preloading (calling StopPreload if necessary). | Misc/PreloadableFile.h | |
void SetPageSize
(
int64 PageSize |
Initialization. | Misc/PreloadableFile.h | |
bool StartPreload () |
Preloading. | Misc/PreloadableFile.h | |
void StopPreload() |
Cancel any current asynchronous ReadRequests and wait for the asynchronous work to exit. | Misc/PreloadableFile.h | |
void WaitForInitialization() |
Wait for InitializeAsync to complete if it is running, otherwise return immediately. | Misc/PreloadableFile.h |
Overridden from FArchive
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual bool Close() |
Attempts to close and finalize any handles used for backing data storage, returns true if it succeeded. | Misc/PreloadableFile.h | |
virtual void Seek
(
int64 InPos |
Attempts to set the current offset into backing data storage, this will do nothing if there is no storage. | Misc/PreloadableFile.h | |
virtual void Serialize
(
void* V, |
FArchive. | Misc/PreloadableFile.h |
Overridden from FArchiveState
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FString GetArchiveName () |
Returns the name of the Archive. | Misc/PreloadableFile.h | |
virtual int64 Tell () |
Returns the current location within the backing data storage, which can possibly be passed to Seek later to restore a read/write location. | Misc/PreloadableFile.h | |
virtual int64 TotalSize () |
Return the size of the file, or -1 if the file does not exist. | Misc/PreloadableFile.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void FreeRetiredRequests() |
Misc/PreloadableFile.h | ||
void InitializeInternal
(
FCreateArchive&& InCreateArchiveFunction, |
Helper function for InitializeAsync, called from a TaskGraph thread. | Misc/PreloadableFile.h | |
void InitializeInternalAsync
(
FCreateArchive&& InCreateArchiveFunction, |
Helper function for InitializeAsync, sets up the asynchronous call to InitializeInternal | Misc/PreloadableFile.h | |
void OnReadComplete
(
bool bCanceled, |
Misc/PreloadableFile.h | ||
void PausePreload() |
Misc/PreloadableFile.h | ||
void ResumePreload() |
Misc/PreloadableFile.h | ||
bool ResumePreloadNonRecursive() |
Misc/PreloadableFile.h | ||
void SerializeSynchronously
(
void* V, |
Misc/PreloadableFile.h |