#include <IStreamer.h>
Inherited by AZ::IO::Streamer.
Public Types | |
using | OnCompleteCallback = AZStd::function< void(FileRequestHandle)> |
Public Member Functions | |
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. | |
|
pure virtual |
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.
request | The request that will store the cancel command. |
target | The request to cancel. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
statistics | The container where statistics will be added to. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
relativePath | Relative path to the file to receive a dedicated cache. This can include aliases such as @products. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
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. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Create a new blank request. Before queuing this request a command must be assigned first.
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
requests | Container where the requests will be stored in. |
count | The number of requests to create. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Creates a custom request. This can be used by extensions to Streamer's stack to add their own commands.
data | Storage for the arguments to the command. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Creates a custom request. This can be used by extensions to Streamer's stack to add their own commands.
request | The request that will store the custom command. |
data | Storage for the arguments to the command. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Destroy a dedicated cache created by CreateDedicatedCache. See CreateDedicatedCache for more details.
relativePath | Relative path to the file that got a dedicated cache. This can include aliases such as @products. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Destroy a dedicated cache created by CreateDedicatedCache. See CreateDedicatedCache for more details.
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. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
relativePath | Relative path to the file that will be cleared from all caches. This can include aliases such as @products. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
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. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
request | The request that will store the command to flush all caches. |
Implemented in AZ::IO::Streamer.
|
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.
request | The request to get the estimation for. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Get the result for operations that read data.
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. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Returns the recommended configuration options for read requests. Following these recommendations will help improve performance, but are optional.
Implemented in AZ::IO::Streamer.
|
pure virtual |
Check the status of a request. This can be called even if the request has not been queued yet.
request | The request to query. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Check if the provided request has completed. This can mean it was successful, failed or was canceled.
request | The request to query. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Whether or not processing of requests has been suspended.
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
request | The request that will be processed. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
requests | The requests that will be processed. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
requests | The requests that will be processed. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Creates a request to 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. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Creates a request to read a file.
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. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Sets a request to the read command.
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. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Sets a request to the read command.
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. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
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. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
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. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
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. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
target | The request that will be rescheduled. |
newDeadline | The new deadline for the request. |
newPriority | The new priority for the request. |
Implemented in AZ::IO::Streamer.
|
pure virtual |
Resumes processing requests in Streamer's stack if previously one or more calls to SuspendProcessing were made.
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.
request | The request that will get the callback assigned. |
callback | A function with the signature "void(FileRequestHandle request);" |
Implemented in AZ::IO::Streamer.
|
pure virtual |
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.