pub struct IsoStorageManager {
entries: [IsoEntry; 8],
entry_count: usize,
esp_start_lba: u64,
target_disk_size_lba: u64,
chunk_size: u64,
}Expand description
ISO storage manager
Manages ISO manifests and coordinates chunk allocation.
Fields§
§entries: [IsoEntry; 8]Cached ISO entries (loaded from ESP)
entry_count: usizeNumber of valid entries
esp_start_lba: u64ESP partition start LBA (for manifest storage)
target_disk_size_lba: u64Target disk for chunk partitions
chunk_size: u64Chunk size to use
Implementations§
Source§impl IsoStorageManager
impl IsoStorageManager
Sourcepub fn set_chunk_size(&mut self, size: u64)
pub fn set_chunk_size(&mut self, size: u64)
Set custom chunk size (must be <= FAT32_MAX_FILE_SIZE)
Sourcepub fn find_by_name(&self, name: &str) -> Option<usize>
pub fn find_by_name(&self, name: &str) -> Option<usize>
Find ISO by name
Sourcepub fn chunks_needed(&self, iso_size: u64) -> usize
pub fn chunks_needed(&self, iso_size: u64) -> usize
Calculate chunks needed for an ISO
Sourcepub fn space_needed(&self, iso_size: u64) -> u64
pub fn space_needed(&self, iso_size: u64) -> u64
Calculate total disk space needed (with FAT32 overhead)
Sourcepub fn has_space_for(&self, iso_size: u64) -> bool
pub fn has_space_for(&self, iso_size: u64) -> bool
Check if there’s enough space for an ISO
This is a quick estimate - actual allocation may vary based on partition alignment and existing partitions.
Sourcepub fn add_entry(&mut self, manifest: IsoManifest) -> Result<usize, IsoError>
pub fn add_entry(&mut self, manifest: IsoManifest) -> Result<usize, IsoError>
Add a manifest entry (called after loading from ESP)
Sourcepub fn remove_entry(&mut self, index: usize) -> Result<(), IsoError>
pub fn remove_entry(&mut self, index: usize) -> Result<(), IsoError>
Remove an ISO entry by index
Sourcepub fn prepare_download(
&mut self,
name: &str,
total_size: u64,
sha256: Option<&[u8; 32]>,
) -> Result<(usize, IsoManifest), IsoError>
pub fn prepare_download( &mut self, name: &str, total_size: u64, sha256: Option<&[u8; 32]>, ) -> Result<(usize, IsoManifest), IsoError>
Prepare storage for a new ISO download
This creates the manifest and reserves partition slots. The actual partitions should be created via GPT operations.
Returns (entry_index, manifest) that can be used with a ChunkWriter.
Sourcepub fn finalize_download(
&mut self,
manifest: IsoManifest,
chunks: ChunkSet,
) -> Result<usize, IsoError>
pub fn finalize_download( &mut self, manifest: IsoManifest, chunks: ChunkSet, ) -> Result<usize, IsoError>
Finalize a download (update manifest, add entry)
Sourcepub fn create_writer(
&self,
manifest: &IsoManifest,
) -> Result<ChunkWriter, IsoError>
pub fn create_writer( &self, manifest: &IsoManifest, ) -> Result<ChunkWriter, IsoError>
Create a ChunkWriter for an ISO download
Sourcepub fn create_reader(&self, index: usize) -> Result<ChunkReader, IsoError>
pub fn create_reader(&self, index: usize) -> Result<ChunkReader, IsoError>
Create a ChunkReader for booting an ISO
Sourcepub fn get_read_context(&self, index: usize) -> Result<IsoReadContext, IsoError>
pub fn get_read_context(&self, index: usize) -> Result<IsoReadContext, IsoError>
Get read context for boot loader (lightweight, copyable)
Sourcepub fn iter(&self) -> IsoEntryIterator<'_> ⓘ
pub fn iter(&self) -> IsoEntryIterator<'_> ⓘ
Iterator over valid ISO entries
Sourcepub fn used_partitions(&self) -> [(u64, u64); 64]
pub fn used_partitions(&self) -> [(u64, u64); 64]
Get list of partition LBAs used by all ISOs
Useful for avoiding allocation conflicts when creating new partitions.
Sourcepub fn esp_start_lba(&self) -> u64
pub fn esp_start_lba(&self) -> u64
Get ESP start LBA
Sourcepub fn chunk_size(&self) -> u64
pub fn chunk_size(&self) -> u64
Get chunk size