#include <IStreamer.h>
Inherited by AZ::IO::Streamer.
|
|
| AZ_RTTI (IStreamer, "{0015594D-6EA5-4309-A2AD-1D704F264A66}") |
| |
| virtual FileRequestPtr | Read (AZStd::string_view relativePath, void *outputBuffer, size_t outputBufferSize, size_t readSize, IStreamerTypes::Deadline deadline=IStreamerTypes::s_noDeadline, IStreamerTypes::Priority priority=IStreamerTypes::s_priorityMedium, size_t offset=0)=0 |
| |
| virtual FileRequestPtr & | Read (FileRequestPtr &request, AZStd::string_view relativePath, void *outputBuffer, size_t outputBufferSize, size_t readSize, IStreamerTypes::Deadline deadline=IStreamerTypes::s_noDeadline, IStreamerTypes::Priority priority=IStreamerTypes::s_priorityMedium, size_t offset=0)=0 |
| |
| virtual FileRequestPtr | Read (AZStd::string_view relativePath, IStreamerTypes::RequestMemoryAllocator &allocator, size_t size, IStreamerTypes::Deadline deadline=IStreamerTypes::s_noDeadline, IStreamerTypes::Priority priority=IStreamerTypes::s_priorityMedium, size_t offset=0)=0 |
| |
| virtual FileRequestPtr & | Read (FileRequestPtr &request, AZStd::string_view relativePath, IStreamerTypes::RequestMemoryAllocator &allocator, size_t size, IStreamerTypes::Deadline deadline=IStreamerTypes::s_noDeadline, IStreamerTypes::Priority priority=IStreamerTypes::s_priorityMedium, size_t offset=0)=0 |
| |
| virtual FileRequestPtr | Cancel (FileRequestPtr target)=0 |
| |
| virtual FileRequestPtr & | Cancel (FileRequestPtr &request, FileRequestPtr target)=0 |
| |
| virtual FileRequestPtr | RescheduleRequest (FileRequestPtr target, IStreamerTypes::Deadline newDeadline, IStreamerTypes::Priority newPriority)=0 |
| |
| virtual FileRequestPtr & | RescheduleRequest (FileRequestPtr &request, FileRequestPtr target, IStreamerTypes::Deadline newDeadline, IStreamerTypes::Priority newPriority)=0 |
| |
| virtual FileRequestPtr | CreateDedicatedCache (AZStd::string_view relativePath)=0 |
| |
| virtual FileRequestPtr & | CreateDedicatedCache (FileRequestPtr &request, AZStd::string_view relativePath)=0 |
| |
| virtual FileRequestPtr | DestroyDedicatedCache (AZStd::string_view relativePath)=0 |
| |
| virtual FileRequestPtr & | DestroyDedicatedCache (FileRequestPtr &request, AZStd::string_view relativePath)=0 |
| |
| virtual FileRequestPtr | FlushCache (AZStd::string_view relativePath)=0 |
| |
| virtual FileRequestPtr & | FlushCache (FileRequestPtr &request, AZStd::string_view relativePath)=0 |
| |
| virtual FileRequestPtr | FlushCaches ()=0 |
| |
| virtual FileRequestPtr & | FlushCaches (FileRequestPtr &request)=0 |
| |
| virtual FileRequestPtr | Report (AZStd::vector< Statistic > &output, IStreamerTypes::ReportType reportType)=0 |
| |
| virtual FileRequestPtr & | Report (FileRequestPtr &request, AZStd::vector< Statistic > &output, IStreamerTypes::ReportType reportType)=0 |
| |
| virtual FileRequestPtr | Custom (AZStd::any data)=0 |
| |
| virtual FileRequestPtr & | Custom (FileRequestPtr &request, AZStd::any data)=0 |
| |
| virtual FileRequestPtr & | SetRequestCompleteCallback (FileRequestPtr &request, OnCompleteCallback callback)=0 |
| |
| virtual FileRequestPtr | CreateRequest ()=0 |
| |
| virtual void | CreateRequestBatch (AZStd::vector< FileRequestPtr > &requests, size_t count)=0 |
| |
| virtual void | QueueRequest (const FileRequestPtr &request)=0 |
| |
| virtual void | QueueRequestBatch (const AZStd::vector< FileRequestPtr > &requests)=0 |
| |
| virtual void | QueueRequestBatch (AZStd::vector< FileRequestPtr > &&requests)=0 |
| |
| virtual bool | HasRequestCompleted (FileRequestHandle request) const =0 |
| |
| virtual IStreamerTypes::RequestStatus | GetRequestStatus (FileRequestHandle request) const =0 |
| |
| virtual AZStd::chrono::steady_clock::time_point | GetEstimatedRequestCompletionTime (FileRequestHandle request) const =0 |
| |
| virtual bool | GetReadRequestResult (FileRequestHandle request, void *&buffer, u64 &numBytesRead, IStreamerTypes::ClaimMemory claimMemory=IStreamerTypes::ClaimMemory::No) const =0 |
| |
| virtual void | CollectStatistics (AZStd::vector< Statistic > &statistics)=0 |
| |
| virtual const IStreamerTypes::Recommendations & | GetRecommendations () const =0 |
| |
| virtual void | SuspendProcessing ()=0 |
| |
| virtual void | ResumeProcessing ()=0 |
| |
| virtual bool | IsSuspended () const =0 |
| | Whether or not processing of requests has been suspended.
|
| |
◆ Cancel() [1/2]
Sets a request to the cancel command. When this request completes it's not guaranteed to have canceled the target request. Not all requests can be canceled and requests that already processing may complete. It's recommended to let the target request handle the completion of the request as normal and handle cancellation by checking the status on the target request is set to IStreamerTypes::RequestStatus::Canceled.
- Parameters
-
| request | The request that will store the cancel command. |
| target | The request to cancel. |
- Returns
- A reference to the provided request.
Implemented in AZ::IO::Streamer.
◆ Cancel() [2/2]
Creates a request to cancel a previously queued request. When this request completes it's not guaranteed to have canceled the target request. Not all requests can be canceled and requests that already processing may complete. It's recommended to let the target request handle the completion of the request as normal and handle cancellation by checking the status on the target request is set to IStreamerTypes::RequestStatus::Canceled. @target The request to cancel.
- Returns
- A smart pointer to the newly created request with the cancel command.
Implemented in AZ::IO::Streamer.
◆ CollectStatistics()
Collect statistics from all the components that make up Streamer. This function is immediately executed and returns immediately with the results. Due to this behavior there's a limit to the number of statistics that can be returned as only lockless retrieval data can be retrieved. The data is also a snapshot so may be slightly out of date. To get additional data use Report.
- Parameters
-
| statistics | The container where statistics will be added to. |
Implemented in AZ::IO::Streamer.
◆ CreateDedicatedCache() [1/2]
Creates a dedicated cache for the target file. The target file won't be removed from the cache until DestroyDedicatedCache is called. Typical use of a dedicated cache is for files that have their own compression and are periodically visited to read a section, e.g. streaming video play or streaming audio banks. This request will fail if there are no nodes in Streamer's stack that deal with dedicated caches.
- Parameters
-
| relativePath | Relative path to the file to receive a dedicated cache. This can include aliases such as @products. |
- Returns
- A smart pointer to the newly created request with the command to create a dedicated cache.
Implemented in AZ::IO::Streamer.
◆ CreateDedicatedCache() [2/2]
Creates a dedicated cache for the target file. The target file won't be removed from the cache until DestroyDedicatedCache is called. Typical use of a dedicated cache is for files that have their own compression and are periodically visited to read a section, e.g. streaming video play or streaming audio banks. This request will fail if there are no nodes in Streamer's stack that deal with dedicated caches.
- Parameters
-
| request | The request that will store the command to create a dedicated cache. |
| relativePath | Relative path to the file to receive a dedicated cache. This can include aliases such as @products. |
- Returns
- A reference to the provided request.
Implemented in AZ::IO::Streamer.
◆ CreateRequest()
Create a new blank request. Before queuing this request a command must be assigned first.
- Returns
- A smart pointer to the newly created request.
Implemented in AZ::IO::Streamer.
◆ CreateRequestBatch()
Creates a number of new blank requests. The requests need to be assigned a command before they can be queued. This function is preferable over CreateRequest if multiple requests are needed as it avoids repeatedly syncing with Streamer's stack.
- Parameters
-
| requests | Container where the requests will be stored in. |
| count | The number of requests to create. |
Implemented in AZ::IO::Streamer.
◆ Custom() [1/2]
Creates a custom request. This can be used by extensions to Streamer's stack to add their own commands.
- Parameters
-
| data | Storage for the arguments to the command. |
- Returns
- A smart pointer to the newly created request with the custom command.
Implemented in AZ::IO::Streamer.
◆ Custom() [2/2]
Creates a custom request. This can be used by extensions to Streamer's stack to add their own commands.
- Parameters
-
| request | The request that will store the custom command. |
| data | Storage for the arguments to the command. |
- Returns
- A reference to the provided request.
Implemented in AZ::IO::Streamer.
◆ DestroyDedicatedCache() [1/2]
Destroy a dedicated cache created by CreateDedicatedCache. See CreateDedicatedCache for more details.
- Parameters
-
| relativePath | Relative path to the file that got a dedicated cache. This can include aliases such as @products. |
- Returns
- A smart pointer to the newly created request with the command to destroy a dedicated cache.
Implemented in AZ::IO::Streamer.
◆ DestroyDedicatedCache() [2/2]
Destroy a dedicated cache created by CreateDedicatedCache. See CreateDedicatedCache for more details.
- Parameters
-
| request | The request that will store the command to destroy a dedicated cache. |
| relativePath | Relative path to the file that got a dedicated cache. This can include aliases such as @products. |
- Returns
- A reference to the provided request.
Implemented in AZ::IO::Streamer.
◆ FlushCache() [1/2]
Clears a file from all caches in use by Streamer. Flushing the cache will cause the streaming stack to pause processing until it's idle before issuing the flush and resuming processing. This can result in a noticeable interruption.
- Parameters
-
| relativePath | Relative path to the file that will be cleared from all caches. This can include aliases such as @products. |
- Returns
- A smart pointer to the newly created request with the command to flush a file from all caches.
Implemented in AZ::IO::Streamer.
◆ FlushCache() [2/2]
Clears a file from all caches in use by Streamer. Flushing the cache will cause the streaming stack to pause processing until it's idle before issuing the flush and resuming processing. This can result in a noticeable interruption.
- Parameters
-
| request | The request that will store the command to flush a file from all caches. |
| relativePath | Relative path to the file that will be cleared from all caches. This can include aliases such as @products. |
- Returns
- A reference to the provided request.
Implemented in AZ::IO::Streamer.
◆ FlushCaches() [1/2]
Forcefully clears out all caches internally held by the streaming stack. This removes all cached information and can result in needing to reload a substantial amount of data. Flushing will cause the streaming stack to pause processing until it's idle before issuing the flush and resuming processing. Both behaviors combined can result in a noticeable interruption. If possible, prefer to use FlushCache instead to reduce the amount of data that would potentially need to be reloaded.
- Returns
- A smart pointer to the newly created request with the command to flush all caches.
Implemented in AZ::IO::Streamer.
◆ FlushCaches() [2/2]
Forcefully clears out all caches internally held by the streaming stack. This removes all cached information and can result in needing to reload a substantial amount of data. Flushing will cause the streaming stack to pause processing until it's idle before issuing the flush and resuming processing. Both behaviors combined can result in a noticeable interruption. If possible, prefer to use FlushCache instead to reduce the amount of data that would potentially need to be reloaded.
- Parameters
-
| request | The request that will store the command to flush all caches. |
- Returns
- A reference to the provided request.
Implemented in AZ::IO::Streamer.
◆ GetEstimatedRequestCompletionTime()
| virtual AZStd::chrono::steady_clock::time_point AZ::IO::IStreamer::GetEstimatedRequestCompletionTime |
( |
FileRequestHandle |
request | ) |
const |
|
pure virtual |
Returns the estimated time that the provided request will complete. Estimation doesn't happen until Streamer's stack has picked up the request and zero will be returned until then. As requests complete and new ones are added the estimated completion time will change over time until the request completes. Not all requests well get an estimation.
- Parameters
-
| request | The request to get the estimation for. |
- Returns
- The system time the request will complete or zero of no estimation has been done.
Implemented in AZ::IO::Streamer.
◆ GetReadRequestResult()
| virtual bool AZ::IO::IStreamer::GetReadRequestResult |
( |
FileRequestHandle |
request, |
|
|
void *& |
buffer, |
|
|
u64 & |
numBytesRead, |
|
|
IStreamerTypes::ClaimMemory |
claimMemory = IStreamerTypes::ClaimMemory::No |
|
) |
| const |
|
pure virtual |
Get the result for operations that read data.
- Parameters
-
| request | The request to query. |
| buffer | The buffer the data was written to. |
| numBytesRead | The total number of bytes that were read from the file. |
- Returns
- True if data could be retrieved, otherwise false.
Implemented in AZ::IO::Streamer.
◆ GetRecommendations()
Returns the recommended configuration options for read requests. Following these recommendations will help improve performance, but are optional.
Implemented in AZ::IO::Streamer.
◆ GetRequestStatus()
Check the status of a request. This can be called even if the request has not been queued yet.
- Parameters
-
| request | The request to query. |
- Returns
- The current status of the request.
Implemented in AZ::IO::Streamer.
◆ HasRequestCompleted()
Check if the provided request has completed. This can mean it was successful, failed or was canceled.
- Parameters
-
| request | The request to query. |
- Returns
- True if the request is no longer pending or processing and has completed, otherwise false.
Implemented in AZ::IO::Streamer.
◆ IsSuspended()
Whether or not processing of requests has been suspended.
Implemented in AZ::IO::Streamer.
◆ QueueRequest()
Queues a request for processing by Streamer's stack. After a request has been queued the request pointer can optionally be stored as Streamer supports fire-and-forget for requests.
- Parameters
-
| request | The request that will be processed. |
Implemented in AZ::IO::Streamer.
◆ QueueRequestBatch() [1/2]
Queue a batch of requests for processing by Streamer's stack. This version will move requests from the container, but not delete them. This function is preferable over QueueRequest if multiple requests need to be queued at the same time as it avoids repeatedly syncing with the Streamer's stack.
- Parameters
-
| requests | The requests that will be processed. |
Implemented in AZ::IO::Streamer.
◆ QueueRequestBatch() [2/2]
Queue a batch of requests for processing by Streamer's stack. This function is preferable over QueueRequest if multiple requests need to be queued at the same time as it avoids repeatedly syncing with the Streamer's stack.
- Parameters
-
| requests | The requests that will be processed. |
Implemented in AZ::IO::Streamer.
◆ Read() [1/4]
Creates a request to the read command.
- Parameters
-
| relativePath | Relative path to the file to load. This can include aliases such as @products. |
| allocator | The allocator used to reserve and release memory for the read request. Memory allocated this way will be automatically freed when there are no more references to the FileRequestPtr. To avoid this, use GetReadRequestResult to claim the pointer and use the provided allocator to release the memory at a later point. The allocator needs to live at least as long as the FileRequestPtr is in use. Do not store the FileRequestPtr in the allocator as this will result in a circular dependency and a memory leak. |
| size | The number of bytes to read from the file at the relative path. |
| deadline | The amount of time from calling Read that the request should complete. Is FileRequest::s_noDeadline if the request doesn't need to be completed before a specific time. |
| priority | The priority used to order requests if multiple requests are at risk of missing their deadline. |
| offset | The offset into the file where reading begins. Warning: reading at an offset other than 0 has a significant impact on performance. |
- Returns
- A smart pointer to the newly created request with the read command.
Implemented in AZ::IO::Streamer.
◆ Read() [2/4]
| virtual FileRequestPtr AZ::IO::IStreamer::Read |
( |
AZStd::string_view |
relativePath, |
|
|
void * |
outputBuffer, |
|
|
size_t |
outputBufferSize, |
|
|
size_t |
readSize, |
|
|
IStreamerTypes::Deadline |
deadline = IStreamerTypes::s_noDeadline, |
|
|
IStreamerTypes::Priority |
priority = IStreamerTypes::s_priorityMedium, |
|
|
size_t |
offset = 0 |
|
) |
| |
|
pure virtual |
Creates a request to read a file.
- Parameters
-
| relativePath | Relative path to the file to load. This can include aliases such as @products. |
| outputBuffer | The buffer that will hold the loaded data. This must be able to at least hold "size" number of bytes. |
| outputBufferSize | The size of the buffer that will hold the loaded data. This must be equal or larger than "size" number of bytes. |
| readSize | The number of bytes to read from the file at the relative path. |
| deadline | The amount of time from calling Read that the request should complete. Is FileRequest::s_noDeadline if the request doesn't need to be completed before a specific time. |
| priority | The priority used to order requests if multiple requests are at risk of missing their deadline. |
| offset | The offset into the file where reading begins. Warning: reading at an offset other than 0 has a significant impact on performance. |
- Returns
- A smart pointer to the newly created request with the read command.
Implemented in AZ::IO::Streamer.
◆ Read() [3/4]
Sets a request to the read command.
- Parameters
-
| request | The request that will store the read command. |
| relativePath | Relative path to the file to load. This can include aliases such as @products. |
| allocator | The allocator used to reserve and release memory for the read request. Memory allocated this way will be automatically freed when there are no more references to the FileRequestPtr. To avoid this, use GetReadRequestResult to claim the pointer and use the provided allocator to release the memory at a later point. The allocator needs to live at least as long as the FileRequestPtr is in use. Do not store the FileRequestPtr in the allocator as this will result in a circular dependency and a memory leak. |
| size | The number of bytes to read from the file at the relative path. |
| deadline | The amount of time from calling Read that the request should complete. Is FileRequest::s_noDeadline if the request doesn't need to be completed before a specific time. |
| priority | The priority used to order requests if multiple requests are at risk of missing their deadline. |
| offset | The offset into the file where reading begins. Warning: reading at an offset other than 0 has a significant impact on performance. |
- Returns
- A reference to the provided request.
Implemented in AZ::IO::Streamer.
◆ Read() [4/4]
| virtual FileRequestPtr & AZ::IO::IStreamer::Read |
( |
FileRequestPtr & |
request, |
|
|
AZStd::string_view |
relativePath, |
|
|
void * |
outputBuffer, |
|
|
size_t |
outputBufferSize, |
|
|
size_t |
readSize, |
|
|
IStreamerTypes::Deadline |
deadline = IStreamerTypes::s_noDeadline, |
|
|
IStreamerTypes::Priority |
priority = IStreamerTypes::s_priorityMedium, |
|
|
size_t |
offset = 0 |
|
) |
| |
|
pure virtual |
Sets a request to the read command.
- Parameters
-
| request | The request that will store the read command. |
| relativePath | Relative path to the file to load. This can include aliases such as @products. |
| outputBuffer | The buffer that will hold the loaded data. This must be able to at least hold "size" number of bytes. |
| outputBufferSize | The size of the buffer that will hold the loaded data. This must be equal or larger than "size" number of bytes. |
| readSize | The number of bytes to read from the file at the relative path. |
| deadline | The amount of time from calling Read that the request should complete. Is FileRequest::s_noDeadline if the request doesn't need to be completed before a specific time. |
| priority | The priority used to order requests if multiple requests are at risk of missing their deadline. |
| offset | The offset into the file where reading begins. Warning: reading at an offset other than 0 has a significant impact on performance. |
- Returns
- A reference to the provided request.
Implemented in AZ::IO::Streamer.
◆ Report() [1/2]
Retrieves statistics for the requested type. This is meant for statistics that can't be retrieved in a lockless manner. For metrics that can be retrieved lockless use CollectStatistics.
- Parameters
-
| output | The storage for the information that's being reported. The container needs to remain alive for the duration of the call. Register a callback with SetRequestCompleteCallback to determine when the container is no longer needed. |
| reportType | The type of information to report. |
- Returns
- A smart pointer to the newly created request with the command to report statistics.
Implemented in AZ::IO::Streamer.
◆ Report() [2/2]
Retrieves statistics for the requested type. This is meant for statistics that can't be retrieved in a lockless manner. For metrics that can be retrieved lockless use CollectStatistics.
- Parameters
-
| request | The request that will store the command to report. |
| output | The storage for the information that's being reported. The container needs to remain alive for the duration of the call. Register a callback with SetRequestCompleteCallback to determine when the container is no longer needed. |
| reportType | The type of information to report. |
- Returns
- A reference to the provided request.
Implemented in AZ::IO::Streamer.
◆ RescheduleRequest() [1/2]
Adjusts the deadline and priority of a request. This has no effect if the requests is already being processed, if the request doesn't contain a command that can be rescheduled or if the request hasn't been queued.
- Parameters
-
| request | The request that will store the reschedule command. |
| target | The request that will be rescheduled. |
| newDeadline | The new deadline for the request. |
| newPriority | The new priority for the request. |
- Returns
- A reference to the provided request.
Implemented in AZ::IO::Streamer.
◆ RescheduleRequest() [2/2]
Adjusts the deadline and priority of a request. This has no effect if the requests is already being processed, if the request doesn't contain a command that can be rescheduled or if the request hasn't been queued.
- Parameters
-
| target | The request that will be rescheduled. |
| newDeadline | The new deadline for the request. |
| newPriority | The new priority for the request. |
- Returns
- A smart pointer to the newly created request with the reschedule command.
Implemented in AZ::IO::Streamer.
◆ ResumeProcessing()
Resumes processing requests in Streamer's stack if previously one or more calls to SuspendProcessing were made.
Implemented in AZ::IO::Streamer.
◆ SetRequestCompleteCallback()
Sets a callback function that will trigger when the provided request completes. The callback will be triggered from within the Streamer's stack on a different thread. While in the callback function Streamer can't continue processing requests so it's recommended to keep the callback short, for instance by setting an atomic value to be picked up by another thread like the main thread or to queue a job (function) to complete the work. Note avoid storing a copy of the owning FileRequestPtr in a lambda provided as the callback. This will result in the same request storing a copy of itself indirectly, which means the reference counter can never reach zero due to the circular dependency and results in a resource leak.
- Parameters
-
| request | The request that will get the callback assigned. |
| callback | A function with the signature "void(FileRequestHandle request);" |
- Returns
- A reference to the provided request.
Implemented in AZ::IO::Streamer.
◆ SuspendProcessing()
Suspends processing of requests in Streamer's stack. New requests can still be queued, but they won't be processed until ResumeProcessing is called.
Implemented in AZ::IO::Streamer.
The documentation for this class was generated from the following file:
- Code/Framework/AzCore/AzCore/IO/IStreamer.h