Skip to main content

AssetStreamCoordinator

Struct AssetStreamCoordinator 

Source
pub struct AssetStreamCoordinator { /* private fields */ }
Expand description

Unified asynchronous asset streaming coordinator orchestrating .euvpak VFS reads, priority decoding, Clock-LRU residency, spatial prefetch, and frame-budgeted GPU uploads.

Implementations§

Source§

impl AssetStreamCoordinator

Request scheduling, coalescing, cancellation, hybrid async/cooperative decoding, Clock-LRU residency, spatial prefetch, and GPU upload draining for AssetStreamCoordinator.

Source

pub fn new(budget: AssetStreamBudget, vfs: Option<Arc<EuvPakArchive>>) -> Self

Creates a new AssetStreamCoordinator bound to budget and an optional mounted EuvPakArchive.

§Arguments
  • AssetStreamBudget - RAM, VRAM, decode time, and GPU upload ceilings.
  • Option<Arc<EuvPakArchive>> - Optional mounted .euvpak virtual filesystem archive.
§Returns
  • Self - Initialized AssetStreamCoordinator.
Source

pub fn new_cooperative( budget: AssetStreamBudget, vfs: Option<Arc<EuvPakArchive>>, ) -> Self

Creates an AssetStreamCoordinator explicitly running in cooperative <= 1.5 ms/frame time-sliced decode mode on any platform.

§Arguments
  • AssetStreamBudget - RAM, VRAM, decode time, and GPU upload ceilings.
  • Option<Arc<EuvPakArchive>> - Optional mounted .euvpak virtual filesystem archive.
§Returns
  • Self - Cooperative time-sliced streaming coordinator.
Source

pub fn with_worker_count( budget: AssetStreamBudget, vfs: Option<Arc<EuvPakArchive>>, worker_count: usize, ) -> Self

Creates an AssetStreamCoordinator with an explicit native background worker thread count.

§Arguments
  • AssetStreamBudget - RAM, VRAM, decode time, and GPU upload ceilings.
  • Option<Arc<EuvPakArchive>> - Optional mounted .euvpak virtual filesystem archive.
  • usize - Background worker thread count (0 selects cooperative time-sliced mode).
§Returns
  • Self - Configured streaming coordinator.
Source

pub fn budget(&self) -> AssetStreamBudget

Returns the active streaming budget configuration.

§Returns
  • AssetStreamBudget - Configured RAM, VRAM, and per-frame ceilings.
Source

pub fn execution_mode(&self) -> StreamExecutionMode

Returns the active execution mode (AsyncWorkers or CooperativeTimeSliced).

§Returns
  • StreamExecutionMode - Active streaming execution mode.
Source

pub fn set_budget(&mut self, next_budget: AssetStreamBudget)

Replaces the active streaming budget configuration at runtime and immediately enforces new ceilings.

§Arguments
  • AssetStreamBudget - Updated RAM, VRAM, and per-frame ceilings.
Source

pub fn warm_bind_mip_tail_superblock(&mut self) -> usize

Binds every TextureMipTail entry from the mounted .euvpak Mip-Tail Superblock into TextureResidencyTier::MipTail for instant Frame-1 visibility with zero blank pop-in.

§Returns
  • usize - Number of texture mip-tails bound immediately into VRAM residency.
Source

pub fn request_asset( &mut self, key_hash: u64, priority: StreamPriority, ) -> StreamRequestHandle

Requests an asynchronous asset load by 64-bit key hash, coalescing duplicate in-flight requests and escalating priority when needed.

§Arguments
  • u64 - Deterministic 64-bit FNV-1a asset key hash.
  • StreamPriority - Requested scheduling priority lane.
§Returns
  • StreamRequestHandle - Handle referencing the active or coalesced request.
Source

pub fn request_path( &mut self, path: &str, priority: StreamPriority, ) -> StreamRequestHandle

Requests an asynchronous asset load by virtual archive path string.

§Arguments
  • &str - Virtual asset path inside the mounted .euvpak.
  • StreamPriority - Requested scheduling priority lane.
§Returns
  • StreamRequestHandle - Handle referencing the active or coalesced request.
Source

pub fn request_texture( &mut self, key_hash: u64, texture_slot: u32, target_tier: TextureResidencyTier, priority: StreamPriority, is_srgb: bool, ) -> StreamRequestHandle

Requests a progressive texture mipmap promotion to target_tier on texture_slot.

§Arguments
  • u64 - Deterministic 64-bit texture asset key hash.
  • u32 - Target GPU bindless texture slot index.
  • TextureResidencyTier - Desired residency tier (MipTail, MidMip, or FullRes).
  • StreamPriority - Scheduling priority lane.
  • bool - True when texels use sRGB encoding.
§Returns
  • StreamRequestHandle - Handle referencing the active or coalesced texture streaming job.
Source

pub fn reprioritize( &mut self, key_hash: u64, new_priority: StreamPriority, ) -> bool

Dynamically reprioritizes an in-flight streaming request onto new_priority.

§Arguments
  • u64 - Deterministic 64-bit asset key hash.
  • StreamPriority - Updated priority lane.
§Returns
  • bool - true when an active in-flight job was reprioritized.
Source

pub fn cancel(&mut self, key_hash: u64) -> bool

Cancels an in-flight asset request by 64-bit key hash.

§Arguments
  • u64 - Deterministic 64-bit asset key hash to cancel.
§Returns
  • bool - true when an active request was found and marked cancelled.
Source

pub fn register_spatial_asset(&mut self, anchor: SpatialAssetAnchor)

Registers a spatial asset anchor for velocity-predicted lookahead prefetching.

§Arguments
  • SpatialAssetAnchor - World-space bounding sphere and asset key hash.
Source

pub fn report_texture_coverage( &mut self, key_hash: u64, screen_coverage_px: f32, camera_distance: f32, visible: bool, ) -> TextureResidencyTier

Updates screen-space coverage for a texture and automatically schedules promotion when visible coverage demands a higher mip tier.

§Arguments
  • u64 - Deterministic 64-bit texture asset key hash.
  • f32 - Projected screen-space size in pixels.
  • f32 - Camera distance in meters.
  • bool - Whether the textured surface is currently visible in the frustum.
§Returns
  • TextureResidencyTier - Target residency tier computed from screen-space coverage.
Source

pub fn update_camera_prefetch( &mut self, camera_pos: [f32; 3], camera_vel: [f32; 3], lookahead_radius: f32, ) -> usize

Updates the camera velocity-predicted spatial prefetch focus volume, schedules PrefetchMedium jobs ahead of arrival, and cancels trailing behind-camera prefetches.

§Arguments
  • [f32; 3] - Current camera world position.
  • [f32; 3] - Current camera world velocity in meters per second.
  • f32 - Spherical prefetch radius in meters.
§Returns
  • usize - Number of speculative prefetch requests enqueued for this update.
Source

pub fn pump_frame_cooperative(&mut self, budget_us: u64) -> usize

Advances cooperative chunked time-sliced decoding strictly within budget_us microseconds on the calling thread.

§Arguments
  • u64 - Hard CPU decode time ceiling in microseconds (e.g. 1_500 for 1.5 ms/frame).
§Returns
  • usize - Number of asset jobs completed during this cooperative slice.
Source

pub fn pump_frame(&mut self, max_decode_us: u64) -> usize

Pumps completed background decodes (or executes cooperative time-sliced decode work on wasm32) strictly within max_decode_us.

§Arguments
  • u64 - Maximum main-thread cooperative or ingestion budget in microseconds.
§Returns
  • usize - Number of asset jobs completed during this pump tick.
Source

pub fn is_idle(&self) -> bool

Returns true when all queued, in-flight, cooperative, and completed streaming work has drained.

§Returns
  • bool - Whether the coordinator is completely idle.
Source

pub fn pump_until_idle(&mut self, max_wait_ms: u64) -> usize

Pumps until all queued async or cooperative jobs complete or max_wait_ms elapses.

§Arguments
  • u64 - Maximum wall-clock wait duration in milliseconds.
§Returns
  • usize - Total jobs completed while draining.
Source

pub fn drain_gpu_uploads( &mut self, max_bytes: usize, max_us: u64, out: &mut Vec<GpuTextureMipUpload>, ) -> usize

Drains ready incremental GPU texture mipmap uploads into out without exceeding max_bytes or max_us.

§Arguments
  • usize - Hard byte budget cap for this frame.
  • u64 - Hard CPU time budget cap in microseconds for this frame.
  • &mut Vec<GpuTextureMipUpload> - Destination vector receiving drained mip upload payloads.
§Returns
  • usize - Total bytes drained into out.
Source

pub fn pending_gpu_upload_count(&self) -> usize

Returns the number of queued incremental GPU texture mipmap uploads waiting to drain.

§Returns
  • usize - Pending GPU upload count.
Source

pub fn residency_pool(&self) -> &ProgressiveResidencyPool

Returns a shared reference to the O(1) Clock-LRU ProgressiveResidencyPool.

§Returns
  • &ProgressiveResidencyPool - Active residency pool reference.
Source

pub fn residency_pool_mut(&mut self) -> &mut ProgressiveResidencyPool

Returns a mutable reference to the O(1) Clock-LRU ProgressiveResidencyPool.

§Returns
  • &mut ProgressiveResidencyPool - Mutable residency pool reference.
Source

pub fn accountant(&self) -> &ResourceAccountant

Returns a shared reference to the authoritative streaming ResourceAccountant.

§Returns
  • &ResourceAccountant - Resource accountant reference.
Source

pub fn accountant_mut(&mut self) -> &mut ResourceAccountant

Returns a mutable reference to the authoritative streaming ResourceAccountant.

§Returns
  • &mut ResourceAccountant - Mutable resource accountant reference.
Source

pub fn release_all_resident(&mut self) -> usize

Releases every resident asset from the Clock-LRU residency pool and removes all tracked handles from ResourceAccountant with zero leaks.

§Returns
  • usize - Number of resident assets released.
Source

pub fn telemetry_snapshot(&self) -> StreamingTelemetrySnapshot

Returns a lock-free snapshot of active streaming telemetry counters.

§Returns
  • StreamingTelemetrySnapshot - Current streaming telemetry counters and memory budgets.

Trait Implementations§

Source§

impl Debug for AssetStreamCoordinator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for AssetStreamCoordinator

Clean worker pool shutdown guaranteeing zero leaked OS threads when AssetStreamCoordinator drops.

Source§

fn drop(&mut self)

Signals background worker shutdown and joins all native streaming threads cleanly.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for AssetStreamCoordinator

§

impl !UnwindSafe for AssetStreamCoordinator

§

impl Forget for AssetStreamCoordinator

§

impl Freeze for AssetStreamCoordinator

§

impl Move for AssetStreamCoordinator

§

impl Send for AssetStreamCoordinator
where Arc<EuvPakArchive>: Send, Arc<StreamingTelemetryCounters>: Send, Arc<PriorityStreamQueue>: Send, Arc<StreamWorkerContext>: Send, RawVecInner: Send, JoinHandle<()>: Send, Arc<Atomic<u8>>: Send, RawTable<(u64, usize)>: Send, RawTable<((TrackedResourceKind, u64), TrackedResourceRecord)>: Send, RawTable<(ResourceOwnerId, (u64, u64))>: Send, RawTable<((i32, i32, i32), Vec<usize>)>: Send, RawTable<(u64, ())>: Send, RawTable<(u64, u32)>: Send,

§

impl Sync for AssetStreamCoordinator
where Arc<EuvPakArchive>: Sync, Arc<StreamingTelemetryCounters>: Sync, Arc<PriorityStreamQueue>: Sync, Arc<StreamWorkerContext>: Sync, RawVecInner: Sync, JoinHandle<()>: Sync, Arc<Atomic<u8>>: Sync, RawTable<(u64, usize)>: Sync, RawTable<((TrackedResourceKind, u64), TrackedResourceRecord)>: Sync, RawTable<(ResourceOwnerId, (u64, u64))>: Sync, RawTable<((i32, i32, i32), Vec<usize>)>: Sync, RawTable<(u64, ())>: Sync, RawTable<(u64, u32)>: Sync,

§

impl Unpin for AssetStreamCoordinator
where Arc<EuvPakArchive>: Unpin, Arc<StreamingTelemetryCounters>: Unpin, Arc<PriorityStreamQueue>: Unpin, Arc<StreamWorkerContext>: Unpin, *const u8 is !null: Unpin, Arc<Inner, System>: Unpin, Arc<Packet<'static, ()>>: Unpin, Arc<Atomic<u8>>: Unpin,

§

impl UnsafeUnpin for AssetStreamCoordinator

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.