[][src]Struct asuran_core::repository::chunk::ChunkID

pub struct ChunkID {
    id: [u8; 32],

Key used for indexing a Chunk in a repository

These are usually derived via an HMAC of the chunks plain text, and are used for reduplication. If two chunks have the same ChunkID, it is assumed that they are identical.


id: [u8; 32]

Keys are a bytestring of length 32

This lines up well with SHA256 and other 256 bit hashes. Longer hashes will be truncated and shorter ones (not reccomended) will be padded with zeros at the end.


impl ChunkID[src]

pub fn new(input_id: &[u8]) -> ChunkID[src]

Will create a new key from a slice.

Keys longer than 32 bytes will be truncated. Keys shorter than 32 bytes will be padded at the end with zeros.

pub fn get_id(&self) -> &[u8][src]

Provides a reference to a key's raw bytes

pub fn verify(&self, slice: &[u8]) -> bool[src]

Verifies equaliy of this key with the first 32 bytes of a slice

pub fn manifest_id() -> ChunkID[src]

Returns the special all-zero key used for the manifest

pub fn random_id() -> ChunkID[src]

Returns a random id, used for testing

Trait Implementations

impl Clone for ChunkID[src]

impl Copy for ChunkID[src]

impl Debug for ChunkID[src]

impl<'de> Deserialize<'de> for ChunkID[src]

impl Eq for ChunkID[src]

impl Hash for ChunkID[src]

impl PartialEq<ChunkID> for ChunkID[src]

impl Serialize for ChunkID[src]

impl StructuralEq for ChunkID[src]

impl StructuralPartialEq for ChunkID[src]

Auto Trait Implementations

impl RefUnwindSafe for ChunkID

impl Send for ChunkID

impl Sync for ChunkID

impl Unpin for ChunkID

impl UnwindSafe for ChunkID

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,