pub struct PersistentCachePieceContent { /* private fields */ }Expand description
PersistentCachePieceContent represents a persistent cache piece metadata and piece content request.
Value Format:
- Metadata Length (4 bytes): Length of the metadata section.
- Number (4 bytes): Piece number to download.
- Offset (8 bytes): Byte offset in the file.
- Length (8 bytes): Length of the piece in bytes.
- Digest Length (4 bytes): Length of the digest field.
- Digest (variable): CRC32 hash of the piece content.
- Parent ID Length (4 bytes): Length of the parent task identifier.
- Parent ID (variable): Parent task identifier.
- Traffic Type (1 byte): Network traffic classification type.
- Cost (8 bytes): Download cost in seconds.
- Created At (8 bytes): Creation timestamp as Unix epoch seconds.
- Content (variable): Piece content bytes.
-------------------------------------------------------------------------------------------------------------------------------------
| Metadata Length (4 bytes) | Number (4 bytes) | Offset (8 bytes) | Length (8 bytes) | Digest Length(8 bytes) | Digest (variable) |
------------------------------------------------------------------------------------------------------------------------------------------
| Parent ID Length(4 bytes) | Parent ID (variable) | Traffic Type (1 byte) | Cost (8 bytes) | Created At (8 bytes) | Content (variable) |
------------------------------------------------------------------------------------------------------------------------------------------Implementations§
Source§impl PersistentCachePieceContent
PersistentCachePieceContent implements the PersistentCachePieceContent functions.
impl PersistentCachePieceContent
PersistentCachePieceContent implements the PersistentCachePieceContent functions.
Sourcepub fn new(
number: u32,
offset: u64,
length: u64,
digest: String,
parent_id: String,
traffic_type: u8,
cost: Duration,
created_at: NaiveDateTime,
) -> Self
pub fn new( number: u32, offset: u64, length: u64, digest: String, parent_id: String, traffic_type: u8, cost: Duration, created_at: NaiveDateTime, ) -> Self
new creates a new PersistentCachePieceContent request.
Sourcepub fn metadata(&self) -> PersistentCachePieceMetadata
pub fn metadata(&self) -> PersistentCachePieceMetadata
metadata returns the persistent cache piece metadata.
Sourcepub fn metadata_len(&self) -> u32
pub fn metadata_len(&self) -> u32
metadata_len returns the length of the metadata section.
Trait Implementations§
Source§impl Clone for PersistentCachePieceContent
impl Clone for PersistentCachePieceContent
Source§fn clone(&self) -> PersistentCachePieceContent
fn clone(&self) -> PersistentCachePieceContent
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 moreSource§impl Debug for PersistentCachePieceContent
impl Debug for PersistentCachePieceContent
Source§impl From<PersistentCachePieceContent> for Bytes
Implement From for Bytes for conversion to a byte slice.
impl From<PersistentCachePieceContent> for Bytes
Implement From
Source§fn from(content: PersistentCachePieceContent) -> Bytes
fn from(content: PersistentCachePieceContent) -> Bytes
from converts the persistent cache piece content request to a byte slice.
Source§impl TryFrom<Bytes> for PersistentCachePieceContent
Implement TryFrom for PersistentCachePieceContent for conversion from a byte slice.
impl TryFrom<Bytes> for PersistentCachePieceContent
Implement TryFrom
Auto Trait Implementations§
impl Freeze for PersistentCachePieceContent
impl RefUnwindSafe for PersistentCachePieceContent
impl Send for PersistentCachePieceContent
impl Sync for PersistentCachePieceContent
impl Unpin for PersistentCachePieceContent
impl UnwindSafe for PersistentCachePieceContent
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