pub struct DistroDownloader {
ui_state: UiState,
download_state: DownloadState,
current_distros: Vec<&'static DistroEntry>,
boot_services: *const BootServices,
image_handle: *mut (),
needs_full_redraw: bool,
iso_storage: IsoStorageManager,
iso_names: [[u8; 64]; 8],
iso_name_lens: [usize; 8],
iso_sizes_mb: [u64; 8],
iso_complete: [bool; 8],
}Expand description
Main distro downloader UI controller
Fields§
§ui_state: UiStateUI navigation state
download_state: DownloadStateDownload progress state
current_distros: Vec<&'static DistroEntry>Cached list of distros for current category
boot_services: *const BootServicesBoot services reference (for file operations)
image_handle: *mut ()Image handle
needs_full_redraw: boolTrack if we need full redraw (mode change, category change)
iso_storage: IsoStorageManagerISO storage manager (for downloaded ISOs)
iso_names: [[u8; 64]; 8]Cached ISO names for display
iso_name_lens: [usize; 8]Cached ISO name lengths
iso_sizes_mb: [u64; 8]Cached ISO sizes (MB)
iso_complete: [bool; 8]Cached ISO completion status
Implementations§
Source§impl DistroDownloader
impl DistroDownloader
Sourcepub fn new(
boot_services: *const BootServices,
image_handle: *mut (),
esp_start_lba: u64,
disk_size_lba: u64,
) -> Self
pub fn new( boot_services: *const BootServices, image_handle: *mut (), esp_start_lba: u64, disk_size_lba: u64, ) -> Self
Create a new distro downloader
§Arguments
boot_services- UEFI boot servicesimage_handle- Current image handleesp_start_lba- Start LBA of ESP partition (for ISO storage)disk_size_lba- Total disk size in LBAs
Sourcefn refresh_iso_cache(&mut self)
fn refresh_iso_cache(&mut self)
Refresh ISO cache from storage manager
Sourcepub fn storage(&self) -> &IsoStorageManager
pub fn storage(&self) -> &IsoStorageManager
Get ISO storage manager reference
Sourcepub fn storage_mut(&mut self) -> &mut IsoStorageManager
pub fn storage_mut(&mut self) -> &mut IsoStorageManager
Get mutable ISO storage manager reference
Sourcefn refresh_distro_list(&mut self)
fn refresh_distro_list(&mut self)
Refresh the distro list for current category
Sourcepub fn selected_distro(&self) -> Option<&'static DistroEntry>
pub fn selected_distro(&self) -> Option<&'static DistroEntry>
Get currently selected distro
Sourcefn handle_input(&mut self, key: &InputKey, screen: &mut Screen) -> ManageAction
fn handle_input(&mut self, key: &InputKey, screen: &mut Screen) -> ManageAction
Handle input and return action
fn handle_browse_input( &mut self, key: &InputKey, screen: &mut Screen, ) -> ManageAction
fn handle_confirm_input( &mut self, key: &InputKey, screen: &mut Screen, ) -> ManageAction
fn handle_download_input( &mut self, key: &InputKey, screen: &mut Screen, ) -> ManageAction
fn handle_result_input( &mut self, key: &InputKey, screen: &mut Screen, ) -> ManageAction
fn handle_manage_input( &mut self, key: &InputKey, screen: &mut Screen, ) -> ManageAction
fn handle_confirm_delete_input( &mut self, key: &InputKey, screen: &mut Screen, ) -> ManageAction
Sourcefn start_download(&mut self, distro: &'static DistroEntry, screen: &mut Screen)
fn start_download(&mut self, distro: &'static DistroEntry, screen: &mut Screen)
Start downloading a distribution
This triggers the commit flow that exits UEFI boot services and downloads in bare-metal mode. This function will NEVER RETURN on success - the system will reboot after download completes.
Sourcepub fn execute_download_with_client<D: NetworkDevice>(
&mut self,
distro: &'static DistroEntry,
client: &mut NativeHttpClient<D>,
screen: &mut Screen,
)
pub fn execute_download_with_client<D: NetworkDevice>( &mut self, distro: &'static DistroEntry, client: &mut NativeHttpClient<D>, screen: &mut Screen, )
Execute the full ISO download flow with an HTTP client
- Check network connectivity (assumes bootstrap already initialized network)
- Check disk space and find free regions
- Create chunk partitions
- Download with streaming to chunk writer
- Finalize and register ISO
§Arguments
distro- The distro to downloadclient- HTTP client from core network initscreen- Display screen
Sourcefn allocate_chunk_partitions(
&self,
free_regions: &[Option<FreeRegion>; 16],
chunks_needed: usize,
total_size: u64,
block_size: usize,
) -> Option<[(u64, u64); 16]>
fn allocate_chunk_partitions( &self, free_regions: &[Option<FreeRegion>; 16], chunks_needed: usize, total_size: u64, block_size: usize, ) -> Option<[(u64, u64); 16]>
Allocate chunk partitions from free space regions
Sourcefn download_with_chunk_writer<D: NetworkDevice>(
&mut self,
url: &str,
expected_size: u64,
client: &mut NativeHttpClient<D>,
chunk_writer: &mut ChunkWriter,
block_io_protocol: *mut BlockIoProtocol,
screen: &mut Screen,
) -> Result<usize, &'static str>
fn download_with_chunk_writer<D: NetworkDevice>( &mut self, url: &str, expected_size: u64, client: &mut NativeHttpClient<D>, chunk_writer: &mut ChunkWriter, block_io_protocol: *mut BlockIoProtocol, screen: &mut Screen, ) -> Result<usize, &'static str>
Download URL and write to chunks via ChunkWriter. Assumes network client is already initialized with DHCP complete and IP assigned.
Sourcefn show_download_error(&mut self, screen: &mut Screen, msg: &str)
fn show_download_error(&mut self, screen: &mut Screen, msg: &str)
Show download error and return to result mode
Sourcefn get_first_disk_block_io(
boot_services: &BootServices,
) -> Option<*mut BlockIoProtocol>
fn get_first_disk_block_io( boot_services: &BootServices, ) -> Option<*mut BlockIoProtocol>
Get BlockIoProtocol pointer for first physical disk
Sourcefn render_full(&mut self, screen: &mut Screen)
fn render_full(&mut self, screen: &mut Screen)
Full render - clears screen if needed and draws everything
Sourcefn render_list_and_details(&self, screen: &mut Screen)
fn render_list_and_details(&self, screen: &mut Screen)
Render only the list and details (for navigation - no clear needed)
fn render_header(&self, screen: &mut Screen)
fn render_categories(&self, screen: &mut Screen)
fn render_list(&self, screen: &mut Screen)
fn render_details(&self, screen: &mut Screen)
fn render_confirm_dialog(&self, screen: &mut Screen)
fn render_progress_only(&self, screen: &mut Screen)
fn render_result(&self, screen: &mut Screen)
Sourcefn pad_or_truncate(s: &str, len: usize) -> String
fn pad_or_truncate(s: &str, len: usize) -> String
Helper: pad or truncate string to exact length
Sourcepub fn run(&mut self, screen: &mut Screen, keyboard: &mut Keyboard)
pub fn run(&mut self, screen: &mut Screen, keyboard: &mut Keyboard)
Main event loop - follows same pattern as main_menu/distro_launcher