BlobContext

Struct BlobContext 

Source
pub struct BlobContext {
Show 25 fields pub blob_id: String, pub blob_hash: Sha256, pub blob_compressor: Algorithm, pub blob_digester: Algorithm, pub blob_cipher: Algorithm, pub blob_prefetch_size: u64, pub blob_meta_info_enabled: bool, pub blob_meta_info: BlobMetaChunkArray, pub blob_meta_header: BlobCompressionContextHeader, pub blob_chunk_digest: Vec<DigestData>, pub compressed_blob_size: u64, pub uncompressed_blob_size: u64, pub current_compressed_offset: u64, pub current_uncompressed_offset: u64, pub chunk_count: u32, pub chunk_size: u32, pub chunk_source: ChunkSource, pub blob_toc_digest: [u8; 32], pub blob_meta_digest: [u8; 32], pub blob_meta_size: u64, pub blob_toc_size: u32, pub entry_list: TocEntryList, pub cipher_object: Arc<Cipher>, pub cipher_ctx: Option<CipherContext>, pub external: bool,
}
Expand description

BlobContext is used to hold the blob information of a layer during build.

Fields§

§blob_id: String

Blob id (user specified or sha256(blob)).

§blob_hash: Sha256§blob_compressor: Algorithm§blob_digester: Algorithm§blob_cipher: Algorithm§blob_prefetch_size: u64§blob_meta_info_enabled: bool

Whether to generate blob metadata information.

§blob_meta_info: BlobMetaChunkArray

Data chunks stored in the data blob, for v6.

§blob_meta_header: BlobCompressionContextHeader

Blob metadata header stored in the data blob, for v6

§blob_chunk_digest: Vec<DigestData>

Blob chunk digest array.

§compressed_blob_size: u64

Final compressed blob file size.

§uncompressed_blob_size: u64

Final expected blob cache file size.

§current_compressed_offset: u64

Current blob offset cursor for writing to disk file.

§current_uncompressed_offset: u64§chunk_count: u32

The number of counts in a blob by the index of blob table.

§chunk_size: u32

Chunk slice size.

§chunk_source: ChunkSource

Whether the blob is from chunk dict.

§blob_toc_digest: [u8; 32]§blob_meta_digest: [u8; 32]§blob_meta_size: u64§blob_toc_size: u32§entry_list: TocEntryList§cipher_object: Arc<Cipher>

Cipher to encrypt the RAFS blobs.

§cipher_ctx: Option<CipherContext>§external: bool

Whether the blob is from external storage backend.

Implementations§

Source§

impl BlobContext

Source

pub fn new( blob_id: String, blob_offset: u64, features: BlobFeatures, compressor: Algorithm, digester: Algorithm, cipher: Algorithm, cipher_object: Arc<Cipher>, cipher_ctx: Option<CipherContext>, external: bool, ) -> Self

Create a new instance of BlobContext.

Source

pub fn from( ctx: &BuildContext, blob: &BlobInfo, chunk_source: ChunkSource, ) -> Result<Self>

Create a new instance of BlobContext from BlobInfo object.

Source

pub fn set_chunk_size(&mut self, chunk_size: u32)

Set chunk size for the blob.

Source

pub fn set_blob_prefetch_size(&mut self, ctx: &BuildContext)

Source

pub fn set_meta_info_enabled(&mut self, enable: bool)

Source

pub fn set_cipher_info( &mut self, cipher_object: Arc<Cipher>, cipher_ctx: Option<CipherContext>, )

Source

pub fn add_chunk_meta_info( &mut self, chunk: &ChunkWrapper, chunk_info: Option<BlobChunkInfoV2Ondisk>, ) -> Result<()>

Source

pub fn alloc_chunk_index(&mut self) -> Result<u32>

Allocate a count index sequentially in a blob.

Source

pub fn blob_id(&self) -> Option<String>

Get blob id if the blob has some chunks.

Source

pub fn write_data( &mut self, blob_writer: &mut dyn Artifact, data: &[u8], ) -> Result<()>

Helper to write data to blob and update blob hash.

Source

pub fn write_tar_header( &mut self, blob_writer: &mut dyn Artifact, name: &str, size: u64, ) -> Result<Header>

Helper to write a tar header to blob and update blob hash.

Source

pub fn compressed_offset(&self) -> u64

Get offset of compressed blob, since current_compressed_offset is always >= compressed_blob_size, we can safely subtract here.

Trait Implementations§

Source§

impl Clone for BlobContext

Source§

fn clone(&self) -> BlobContext

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.