pub struct ResourceAdvertisement {
pub transfer_size: u64,
pub data_size: u64,
pub num_parts: u64,
pub resource_hash: Vec<u8>,
pub random_hash: Vec<u8>,
pub original_hash: Vec<u8>,
pub hashmap: Vec<u8>,
pub flags: AdvFlags,
pub segment_index: u64,
pub total_segments: u64,
pub request_id: Option<Vec<u8>>,
}Expand description
Resource advertisement data, corresponding to Python’s ResourceAdvertisement.
Fields§
§transfer_size: u64Transfer size (encrypted data size)
data_size: u64Total uncompressed data size (including metadata overhead)
num_parts: u64Number of parts
resource_hash: Vec<u8>Resource hash (full 32 bytes)
random_hash: Vec<u8>Random hash (4 bytes)
original_hash: Vec<u8>Original hash (first segment, 32 bytes)
hashmap: Vec<u8>Hashmap segment (concatenated 4-byte part hashes)
flags: AdvFlagsFlags byte
segment_index: u64Segment index (1-based)
total_segments: u64Total segments
request_id: Option<Vec<u8>>Request ID (optional)
Implementations§
Source§impl ResourceAdvertisement
impl ResourceAdvertisement
Sourcepub fn pack(&self, segment: usize) -> Vec<u8> ⓘ
pub fn pack(&self, segment: usize) -> Vec<u8> ⓘ
Pack the advertisement to msgpack bytes.
segment controls which hashmap segment to include (0-based).
Sourcepub fn unpack(data: &[u8]) -> Result<Self, ResourceError>
pub fn unpack(data: &[u8]) -> Result<Self, ResourceError>
Unpack an advertisement from msgpack bytes.
Sourcepub fn is_request(&self) -> bool
pub fn is_request(&self) -> bool
Check if this advertisement is a request.
Sourcepub fn is_response(&self) -> bool
pub fn is_response(&self) -> bool
Check if this advertisement is a response.
Sourcepub fn hashmap_segments(&self) -> usize
pub fn hashmap_segments(&self) -> usize
Get the number of hashmap segments needed.
Trait Implementations§
Source§impl Clone for ResourceAdvertisement
impl Clone for ResourceAdvertisement
Source§fn clone(&self) -> ResourceAdvertisement
fn clone(&self) -> ResourceAdvertisement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ResourceAdvertisement
impl RefUnwindSafe for ResourceAdvertisement
impl Send for ResourceAdvertisement
impl Sync for ResourceAdvertisement
impl Unpin for ResourceAdvertisement
impl UnwindSafe for ResourceAdvertisement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more