morpheus_core::iso

Struct IsoStorageManager

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

Number of valid entries

§esp_start_lba: u64

ESP partition start LBA (for manifest storage)

§target_disk_size_lba: u64

Target disk for chunk partitions

§chunk_size: u64

Chunk size to use

Implementations§

Source§

impl IsoStorageManager

Source

pub fn new(esp_start_lba: u64, target_disk_size_lba: u64) -> Self

Create a new storage manager

Source

pub fn set_chunk_size(&mut self, size: u64)

Set custom chunk size (must be <= FAT32_MAX_FILE_SIZE)

Source

pub fn count(&self) -> usize

Get number of stored ISOs

Source

pub fn get(&self, index: usize) -> Option<&IsoEntry>

Get ISO entry by index

Source

pub fn find_by_name(&self, name: &str) -> Option<usize>

Find ISO by name

Source

pub fn chunks_needed(&self, iso_size: u64) -> usize

Calculate chunks needed for an ISO

Source

pub fn space_needed(&self, iso_size: u64) -> u64

Calculate total disk space needed (with FAT32 overhead)

Source

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.

Source

pub fn add_entry(&mut self, manifest: IsoManifest) -> Result<usize, IsoError>

Add a manifest entry (called after loading from ESP)

Source

pub fn remove_entry(&mut self, index: usize) -> Result<(), IsoError>

Remove an ISO entry by index

Source

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.

Source

pub fn finalize_download( &mut self, manifest: IsoManifest, chunks: ChunkSet, ) -> Result<usize, IsoError>

Finalize a download (update manifest, add entry)

Source

pub fn create_writer( &self, manifest: &IsoManifest, ) -> Result<ChunkWriter, IsoError>

Create a ChunkWriter for an ISO download

Source

pub fn create_reader(&self, index: usize) -> Result<ChunkReader, IsoError>

Create a ChunkReader for booting an ISO

Source

pub fn get_read_context(&self, index: usize) -> Result<IsoReadContext, IsoError>

Get read context for boot loader (lightweight, copyable)

Source

pub fn iter(&self) -> IsoEntryIterator<'_>

Iterator over valid ISO entries

Source

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.

Source

pub fn esp_start_lba(&self) -> u64

Get ESP start LBA

Source

pub fn chunk_size(&self) -> u64

Get chunk size

Trait Implementations§

Source§

impl Default for IsoStorageManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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.