BlobManager

Struct BlobManager 

Source
pub struct BlobManager {
    pub external: bool,
    /* private fields */
}
Expand description

BlobManager stores all blob related information during build.

Fields§

§external: bool

Implementations§

Source§

impl BlobManager

Source

pub fn new(digester: Algorithm, external: bool) -> Self

Create a new instance of BlobManager.

Source

pub fn set_current_blob_index(&mut self, index: usize)

Set current blob index

Source

pub fn new_blob_ctx(&self, ctx: &BuildContext) -> Result<BlobContext>

Source

pub fn get_or_create_current_blob( &mut self, ctx: &BuildContext, ) -> Result<(u32, &mut BlobContext)>

Get the current blob object or create one if no current blob available.

Source

pub fn get_or_create_blob_by_idx( &mut self, ctx: &BuildContext, blob_idx: u32, ) -> Result<(u32, &mut BlobContext)>

Source

pub fn get_current_blob(&mut self) -> Option<(u32, &mut BlobContext)>

Get the current blob object.

Source

pub fn get_or_cerate_blob_for_chunkdict( &mut self, ctx: &BuildContext, id: &str, ) -> Result<(u32, &mut BlobContext)>

Get or cerate blob for chunkdict, this is used for chunk deduplication.

Source

pub fn has_blob(&self, blob_id: &str) -> bool

Determine if the given blob has been created.

Source

pub fn set_chunk_dict(&mut self, dict: Arc<dyn ChunkDict>)

Set the global chunk dictionary for chunk deduplication.

Source

pub fn get_chunk_dict(&self) -> Arc<dyn ChunkDict>

Get the global chunk dictionary for chunk deduplication.

Source

pub fn alloc_index(&self) -> Result<u32>

Allocate a blob index sequentially.

This should be paired with Self::add() and keep in consistence.

Source

pub fn len(&self) -> usize

Get number of blobs managed by the manager.

Source

pub fn is_empty(&self) -> bool

Check whether there’s managed blobs.

Source

pub fn add_blob(&mut self, blob_ctx: BlobContext)

Add a blob context to manager

This should be paired with Self::alloc_index() and keep in consistence.

Source

pub fn get_blobs(&self) -> Vec<&BlobContext>

Get all blob contexts (include the blob context that does not have a blob).

Source

pub fn get_blob(&self, idx: usize) -> Option<&BlobContext>

Source

pub fn take_blob(&mut self, idx: usize) -> BlobContext

Source

pub fn get_last_blob(&self) -> Option<&BlobContext>

Source

pub fn get_blob_idx_by_id(&self, id: &str) -> Option<u32>

Source

pub fn get_blob_ids(&self) -> Vec<String>

Source

pub fn extend_from_blob_table( &mut self, ctx: &BuildContext, blob_table: Vec<Arc<BlobInfo>>, ) -> Result<()>

Prepend all blobs from blob_table to the blob manager.

Source

pub fn extend_from_chunk_dict(&mut self, ctx: &BuildContext) -> Result<()>

Import all blobs from the global chunk dictionary for later chunk deduplication.

The order to import blobs from parent bootstrap and chunk dictionary is important. All blobs from parent bootstrap must be imported first, otherwise we need to fix blob index of chunks from parent bootstrap.

Source

pub fn to_blob_table(&self, build_ctx: &BuildContext) -> Result<RafsBlobTable>

Generate a RafsBlobTable from all blobs managed by the manager.

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> Same for T

Source§

type Output = T

Should always be Self
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.