morpheus_network::transfer::orchestrator

Struct PersistenceOrchestrator

Source
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: OrchestratorState

Current state.

§disk_writer: DiskWriterState

Disk writer state machine.

§start_sector: u64

Configuration.

§expected_size: u64§verify_checksum: bool§expected_checksum: Option<[u8; 32]>§bytes_downloaded: u64

Tracking.

§start_tsc: u64

Timing.

§download_start_tsc: u64§result: PersistenceResult

Result.

§error: Option<OrchestratorError>

Error.

§cancelled: bool

Whether cancelled.

Implementations§

Source§

impl PersistenceOrchestrator

Source

pub fn new(config: PersistenceConfig<'_>) -> Self

Create new orchestrator with configuration.

Source

pub fn phase(&self) -> PersistencePhase

Get current phase.

Source

pub fn progress(&self) -> PersistenceProgress

Get combined progress.

Source

pub fn result(&self) -> Option<PersistenceResult>

Get result (if complete).

Source

pub fn error(&self) -> Option<OrchestratorError>

Get error (if failed).

Source

pub fn is_complete(&self) -> bool

Check if complete.

Source

pub fn is_failed(&self) -> bool

Check if failed.

Source

pub fn cancel(&mut self)

Cancel the operation.

Source

pub fn start<B: BlockDriver>( &mut self, block_driver: &B, now_tsc: u64, ) -> Result<(), OrchestratorError>

Start the orchestrator.

Must be called before step().

Source

pub fn dhcp_complete(&mut self, now_tsc: u64)

Signal that DHCP is complete.

Source

pub fn connected(&mut self)

Signal that HTTP connection is established.

Source

pub fn set_total_bytes(&mut self, total: u64)

Set total expected size (from HTTP Content-Length).

Source

pub fn step<B: BlockDriver>( &mut self, block_driver: &mut B, now_tsc: u64, ) -> OrchestratorResult

Step the orchestrator (poll completions).

Source

fn finalize(&mut self, now_tsc: u64)

Finalize results.

Source

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.

Source

pub fn http_complete(&mut self)

Signal that HTTP download is complete.

Source

pub fn http_failed(&mut self)

Signal HTTP failure.

Source

pub fn can_write(&self) -> bool

Check if writer can accept more data (backpressure).

Source

pub fn disk_writer(&self) -> &DiskWriterState

Get disk writer state.

Source

pub fn disk_writer_mut(&mut self) -> &mut DiskWriterState

Get mutable disk writer.

Auto Trait Implementations§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.