StreamableResource Class
Namespace: Stride.StreamingAssembly: Stride.Rendering.dll
Base class for all resources that can be dynamicly streamed.
public abstract class StreamableResource : ComponentBase, IDisposable, IComponent, IReferencable, ICollectorHolder
| Name | Description | |
|---|---|---|
| Constructors | ||
| StreamableResource(StreamingManager) | ||
| Fields | ||
| cancellationToken | ||
| fileProvider | ||
| StreamingOptions | The current streaming options of the resource. |
|
| Properties | ||
| AllocatedResidency | Gets the allocated residency level. |
|
| CurrentResidency | Gets the current residency level. |
|
| IsAllocated | Gets a value indicating whether this resource is allocated. |
|
| Manager | Gets the manager. |
|
| MaxResidency | Gets the maximum residency level. |
|
| Resource | Gets the resource object. |
|
| Storage | Gets the resource storage. |
|
| TargetResidency | Gets the target residency level. |
|
| Methods | ||
| CalculateRequestedResidency(Int32) | Calculates the requested residency level for this resource based on a given target residency. Resource can control how to change it's residency up/down and if do it at once or in steps, etc.. This gives more control over per resource streaming. |
|
| CalculateTargetResidency(StreamingQuality) | Calculates the target residency level for this resource based on a given uniform quality. |
|
| Destroy() | Disposes of object resources. |
|
| Init(IDatabaseFileProviderService, ContentStorage) | ||
| StopStreaming() | Stops the resource streaming using cancellation token. |
|
| StreamAsync(Int32) | Stream resource to the target residency level. |
|
Constructors
StreamableResource(StreamingManager)
protected StreamableResource(StreamingManager manager)
Parameters
| Type | Name | Description |
|---|---|---|
| StreamingManager | manager |
Fields
cancellationToken
protected CancellationTokenSource cancellationToken
Field Value
| Type | Description |
|---|---|
| System.Threading.CancellationTokenSource |
fileProvider
protected DatabaseFileProvider fileProvider
Field Value
| Type | Description |
|---|---|
| DatabaseFileProvider |
StreamingOptions
The current streaming options of the resource.
public StreamingOptions? StreamingOptions
Field Value
| Type | Description |
|---|---|
| System.Nullable<StreamingOptions> |
Properties
AllocatedResidency
Gets the allocated residency level.
public abstract int AllocatedResidency { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
CurrentResidency
Gets the current residency level.
public abstract int CurrentResidency { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
IsAllocated
Gets a value indicating whether this resource is allocated.
public bool IsAllocated { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Manager
Gets the manager.
public StreamingManager Manager { get; }
Property Value
| Type | Description |
|---|---|
| StreamingManager |
MaxResidency
Gets the maximum residency level.
public abstract int MaxResidency { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Resource
Gets the resource object.
public abstract object Resource { get; }
Property Value
| Type | Description |
|---|---|
| System.Object |
Storage
Gets the resource storage.
public ContentStorage Storage { get; }
Property Value
| Type | Description |
|---|---|
| ContentStorage |
TargetResidency
Gets the target residency level.
public int TargetResidency { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
CalculateRequestedResidency(Int32)
Calculates the requested residency level for this resource based on a given target residency. Resource can control how to change it's residency up/down and if do it at once or in steps, etc.. This gives more control over per resource streaming.
public abstract int CalculateRequestedResidency(int targetResidency)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | targetResidency | The target residency. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Requested residency. |
CalculateTargetResidency(StreamingQuality)
Calculates the target residency level for this resource based on a given uniform quality.
public abstract int CalculateTargetResidency(StreamingQuality quality)
Parameters
| Type | Name | Description |
|---|---|---|
| StreamingQuality | quality | The quality. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Target residency. |
Destroy()
Disposes of object resources.
protected override void Destroy()
Overrides
Init(IDatabaseFileProviderService, ContentStorage)
protected void Init(IDatabaseFileProviderService databaseFileProviderService, ContentStorage storage)
Parameters
| Type | Name | Description |
|---|---|---|
| IDatabaseFileProviderService | databaseFileProviderService | |
| ContentStorage | storage |
StopStreaming()
Stops the resource streaming using cancellation token.
public void StopStreaming()
StreamAsync(Int32)
Stream resource to the target residency level.
protected abstract Task StreamAsync(int residency)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | residency | The target residency. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |