pub struct BlobManager {
pub external: bool,
/* private fields */
}Expand description
BlobManager stores all blob related information during build.
Fields§
§external: boolImplementations§
Source§impl BlobManager
impl BlobManager
Sourcepub fn new(digester: Algorithm, external: bool) -> Self
pub fn new(digester: Algorithm, external: bool) -> Self
Create a new instance of BlobManager.
Sourcepub fn set_current_blob_index(&mut self, index: usize)
pub fn set_current_blob_index(&mut self, index: usize)
Set current blob index
pub fn new_blob_ctx(&self, ctx: &BuildContext) -> Result<BlobContext>
Sourcepub fn get_or_create_current_blob(
&mut self,
ctx: &BuildContext,
) -> Result<(u32, &mut BlobContext)>
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.
pub fn get_or_create_blob_by_idx( &mut self, ctx: &BuildContext, blob_idx: u32, ) -> Result<(u32, &mut BlobContext)>
Sourcepub fn get_current_blob(&mut self) -> Option<(u32, &mut BlobContext)>
pub fn get_current_blob(&mut self) -> Option<(u32, &mut BlobContext)>
Get the current blob object.
Sourcepub fn get_or_cerate_blob_for_chunkdict(
&mut self,
ctx: &BuildContext,
id: &str,
) -> Result<(u32, &mut BlobContext)>
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.
Sourcepub fn set_chunk_dict(&mut self, dict: Arc<dyn ChunkDict>)
pub fn set_chunk_dict(&mut self, dict: Arc<dyn ChunkDict>)
Set the global chunk dictionary for chunk deduplication.
Sourcepub fn get_chunk_dict(&self) -> Arc<dyn ChunkDict>
pub fn get_chunk_dict(&self) -> Arc<dyn ChunkDict>
Get the global chunk dictionary for chunk deduplication.
Sourcepub fn alloc_index(&self) -> Result<u32>
pub fn alloc_index(&self) -> Result<u32>
Allocate a blob index sequentially.
This should be paired with Self::add() and keep in consistence.
Sourcepub fn add_blob(&mut self, blob_ctx: BlobContext)
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.
Sourcepub fn get_blobs(&self) -> Vec<&BlobContext>
pub fn get_blobs(&self) -> Vec<&BlobContext>
Get all blob contexts (include the blob context that does not have a blob).
pub fn get_blob(&self, idx: usize) -> Option<&BlobContext>
pub fn take_blob(&mut self, idx: usize) -> BlobContext
pub fn get_last_blob(&self) -> Option<&BlobContext>
pub fn get_blob_idx_by_id(&self, id: &str) -> Option<u32>
pub fn get_blob_ids(&self) -> Vec<String>
Sourcepub fn extend_from_blob_table(
&mut self,
ctx: &BuildContext,
blob_table: Vec<Arc<BlobInfo>>,
) -> Result<()>
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.
Sourcepub fn extend_from_chunk_dict(&mut self, ctx: &BuildContext) -> Result<()>
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.
Sourcepub fn to_blob_table(&self, build_ctx: &BuildContext) -> Result<RafsBlobTable>
pub fn to_blob_table(&self, build_ctx: &BuildContext) -> Result<RafsBlobTable>
Generate a RafsBlobTable from all blobs managed by the manager.