pub struct DeviceState<C, B, P, Q, E> { /* private fields */ }Expand description
Complete typed object graph for one device instance.
Implementations§
Source§impl<C, B, P, Q, E> DeviceState<C, B, P, Q, E>
impl<C, B, P, Q, E> DeviceState<C, B, P, Q, E>
pub fn new( namespace: ObjectNamespace, limits: DeviceLimits, policy: ResourcePolicy, ) -> Result<Self, DeviceStateConfigError>
pub const fn limits(&self) -> DeviceLimits
pub const fn resource_policy(&self) -> ResourcePolicy
Sourcepub const fn retained_bytes(&self) -> RetainedBytes
pub const fn retained_bytes(&self) -> RetainedBytes
Bulk bytes still represented by live or releasing provider handles.
pub const fn namespace(&self) -> ObjectNamespace
pub const fn resource_counts(&self) -> ResourceCounts
pub const fn is_empty(&self) -> bool
pub const fn context_count(&self) -> u32
pub const fn buffer_count(&self) -> u32
pub const fn program_count(&self) -> u32
pub const fn queue_count(&self) -> u32
pub const fn event_count(&self) -> u32
Sourcepub fn context_ids(&self) -> impl Iterator<Item = ObjectId> + '_
pub fn context_ids(&self) -> impl Iterator<Item = ObjectId> + '_
Occupied context identities, including records awaiting release commit. Iteration allocates nothing and does not authorize release or bypass child checks.
Sourcepub fn buffer_ids(&self) -> impl Iterator<Item = ObjectId> + '_
pub fn buffer_ids(&self) -> impl Iterator<Item = ObjectId> + '_
Occupied buffer identities, including records awaiting release commit. Iteration allocates nothing and does not bypass in-flight reference checks.
Sourcepub fn program_ids(&self) -> impl Iterator<Item = ObjectId> + '_
pub fn program_ids(&self) -> impl Iterator<Item = ObjectId> + '_
Occupied program identities, including records awaiting release commit.
Sourcepub fn queue_ids(&self) -> impl Iterator<Item = ObjectId> + '_
pub fn queue_ids(&self) -> impl Iterator<Item = ObjectId> + '_
Occupied queue identities, including records awaiting release commit.
Sourcepub fn event_ids(&self) -> impl Iterator<Item = ObjectId> + '_
pub fn event_ids(&self) -> impl Iterator<Item = ObjectId> + '_
Occupied event identities, including records awaiting release commit. An enumerated event may still be pending; enumeration is not completion evidence.
pub fn context_record( &self, id: ObjectId, ) -> Result<&ContextRecord<C>, DeviceStateError>
pub fn buffer_record( &self, id: ObjectId, ) -> Result<&BufferRecord<B>, DeviceStateError>
pub fn buffer_record_mut( &mut self, id: ObjectId, ) -> Result<&mut BufferRecord<B>, DeviceStateError>
pub fn program_record( &self, id: ObjectId, ) -> Result<&ProgramRecord<P>, DeviceStateError>
pub fn queue_record( &self, id: ObjectId, ) -> Result<&QueueRecord<Q>, DeviceStateError>
pub fn event_record( &self, id: ObjectId, ) -> Result<&EventRecord<E>, DeviceStateError>
pub fn create_context_with<ProviderError>( &mut self, create: impl FnOnce() -> Result<C, ProviderError>, ) -> Result<ObjectId, CreateError<ProviderError>>
pub fn create_buffer_with<ProviderError>( &mut self, context_id: ObjectId, desc: BufferDesc, create: impl FnOnce(&C, BufferDesc) -> Result<(B, BufferInfo), ProviderError>, ) -> Result<BufferCreateOutcome, CreateError<ProviderError>>
pub fn create_program_with<ProviderError>( &mut self, context_id: ObjectId, artifact_bytes: u64, resident_bytes: u64, create: impl FnOnce(&C) -> Result<P, ProviderError>, ) -> Result<ObjectId, CreateError<ProviderError>>
pub fn create_queue_with<ProviderError>( &mut self, context_id: ObjectId, create: impl FnOnce(&C) -> Result<Q, ProviderError>, ) -> Result<ObjectId, CreateError<ProviderError>>
pub fn create_event_with<ProviderError>( &mut self, queue_id: ObjectId, program_id: ObjectId, buffer_ids: Vec<ObjectId>, create: impl FnOnce(SubmissionResources<'_, B, P, Q>) -> Result<E, ProviderError>, ) -> Result<ObjectId, CreateError<ProviderError>>
Sourcepub fn create_event_sequence_with<ProviderError>(
&mut self,
queue_id: ObjectId,
program_ids: Vec<ObjectId>,
buffer_ids: Vec<ObjectId>,
create: impl FnOnce(SubmissionSequenceResources<'_, B, P, Q>) -> Result<E, ProviderError>,
) -> Result<ObjectId, CreateError<ProviderError>>
pub fn create_event_sequence_with<ProviderError>( &mut self, queue_id: ObjectId, program_ids: Vec<ObjectId>, buffer_ids: Vec<ObjectId>, create: impl FnOnce(SubmissionSequenceResources<'_, B, P, Q>) -> Result<E, ProviderError>, ) -> Result<ObjectId, CreateError<ProviderError>>
Admit one event that retains an ordered sequence of programs.
This is a provider-side lifecycle primitive, not a wire operation. The caller chooses a bounded encoding and validates each invocation’s bindings before entering this method. All programs, the queue and every buffer must belong to one context; none can be released until the event is committed.