pub struct PersistenceOrchestrator {
state: OrchestratorState,
disk_writer: DiskWriterState,
start_sector: u64,
expected_size: u64,
verify_checksum: bool,
expected_checksum: Option<[u8; 32]>,
bytes_downloaded: u64,
start_tsc: u64,
download_start_tsc: u64,
result: PersistenceResult,
error: Option<OrchestratorError>,
cancelled: bool,
}Expand description
Persistence orchestrator.
Coordinates HTTP download with disk writing for ISO persistence. This is a simplified version that manages disk writing state.
Fields§
§state: OrchestratorStateCurrent state.
disk_writer: DiskWriterStateDisk writer state machine.
start_sector: u64Configuration.
expected_size: u64§verify_checksum: bool§expected_checksum: Option<[u8; 32]>§bytes_downloaded: u64Tracking.
start_tsc: u64Timing.
download_start_tsc: u64§result: PersistenceResultResult.
error: Option<OrchestratorError>Error.
cancelled: boolWhether cancelled.
Implementations§
Source§impl PersistenceOrchestrator
impl PersistenceOrchestrator
Sourcepub fn new(config: PersistenceConfig<'_>) -> Self
pub fn new(config: PersistenceConfig<'_>) -> Self
Create new orchestrator with configuration.
Sourcepub fn phase(&self) -> PersistencePhase
pub fn phase(&self) -> PersistencePhase
Get current phase.
Sourcepub fn progress(&self) -> PersistenceProgress
pub fn progress(&self) -> PersistenceProgress
Get combined progress.
Sourcepub fn result(&self) -> Option<PersistenceResult>
pub fn result(&self) -> Option<PersistenceResult>
Get result (if complete).
Sourcepub fn error(&self) -> Option<OrchestratorError>
pub fn error(&self) -> Option<OrchestratorError>
Get error (if failed).
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if complete.
Sourcepub fn start<B: BlockDriver>(
&mut self,
block_driver: &B,
now_tsc: u64,
) -> Result<(), OrchestratorError>
pub fn start<B: BlockDriver>( &mut self, block_driver: &B, now_tsc: u64, ) -> Result<(), OrchestratorError>
Start the orchestrator.
Must be called before step().
Sourcepub fn dhcp_complete(&mut self, now_tsc: u64)
pub fn dhcp_complete(&mut self, now_tsc: u64)
Signal that DHCP is complete.
Sourcepub fn set_total_bytes(&mut self, total: u64)
pub fn set_total_bytes(&mut self, total: u64)
Set total expected size (from HTTP Content-Length).
Sourcepub fn step<B: BlockDriver>(
&mut self,
block_driver: &mut B,
now_tsc: u64,
) -> OrchestratorResult
pub fn step<B: BlockDriver>( &mut self, block_driver: &mut B, now_tsc: u64, ) -> OrchestratorResult
Step the orchestrator (poll completions).
Sourcepub fn write_data<B: BlockDriver>(
&mut self,
block_driver: &mut B,
buffer_phys: u64,
len: usize,
) -> Result<(), DiskWriterError>
pub fn write_data<B: BlockDriver>( &mut self, block_driver: &mut B, buffer_phys: u64, len: usize, ) -> Result<(), DiskWriterError>
Write a chunk of data to disk.
Called when HTTP data is received.
Sourcepub fn http_complete(&mut self)
pub fn http_complete(&mut self)
Signal that HTTP download is complete.
Sourcepub fn http_failed(&mut self)
pub fn http_failed(&mut self)
Signal HTTP failure.
Sourcepub fn disk_writer(&self) -> &DiskWriterState
pub fn disk_writer(&self) -> &DiskWriterState
Get disk writer state.
Sourcepub fn disk_writer_mut(&mut self) -> &mut DiskWriterState
pub fn disk_writer_mut(&mut self) -> &mut DiskWriterState
Get mutable disk writer.
Auto Trait Implementations§
impl Freeze for PersistenceOrchestrator
impl RefUnwindSafe for PersistenceOrchestrator
impl Send for PersistenceOrchestrator
impl Sync for PersistenceOrchestrator
impl Unpin for PersistenceOrchestrator
impl UnwindSafe for PersistenceOrchestrator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more