[][src]Struct asuran::repository::backend::common::manifest::ManifestTransaction

pub struct ManifestTransaction {
    previous_heads: Vec<ManifestID>,
    pointer: ChunkID,
    timestamp: DateTime<FixedOffset>,
    name: String,
    nonce: [u8; 16],
    hmac: HMAC,
    tag: ManifestID,

Describes a transaction in a manifest


previous_heads: Vec<ManifestID>

The HMACs of all previous branch heads in the repository that this transaction references

pointer: ChunkID

The location of the archive this trasnaction refrences within the archive

timestamp: DateTime<FixedOffset>

The timestamp of this Transactions Creation

name: String

The human readable name of the archive

nonce: [u8; 16]

A 128-bit random nonce

This is canonically stored as an array of bytes, to keep the serializer and deserializer simple, while preventing issues with other platforms who may not have support for the exact same integer types as rust

This value is used for ensuring uniqueness when constructing the Manifest Merkle Tree

hmac: HMAC

The type of HMAC used for this transaction

tag: ManifestID

The HMAC tag of this transaction

This is calculated based off the compact (array form) messagepacked encoding of this struct with this value set to all zeros


impl ManifestTransaction[src]

pub fn new(
    previous_heads: &[ManifestID],
    pointer: ChunkID,
    timestamp: DateTime<FixedOffset>,
    name: &str,
    hmac: HMAC,
    key: &Key
) -> ManifestTransaction

Constructs a new ManifestTransaction from the given list of previous heads, a pointer, a name, a timestamp, and an HMAC method to use

Will automatically produce the random nonce, and update the tag

fn update_tag(&mut self, key: &Key)[src]

Serializes the struct, performs the HMAC, and updates the value in place

Will zero the hmac value before performing the operation

pub fn previous_heads(&self) -> &[ManifestID][src]

Returns a refrence to the list of previous heads

pub fn pointer(&self) -> ChunkID[src]

Returns the pointer to the archive in the repository

pub fn name(&self) -> &str[src]

Returns the name of the archive

pub fn timestamp(&self) -> DateTime<FixedOffset>[src]

Returns the timestamp of the archive

pub fn tag(&self) -> ManifestID[src]

Returns the HMAC value tag of this transaction

pub fn verify(&self, key: &Key) -> bool[src]

Verifies the hmac of the transaction

This does not descend down the DAG, will only verfiy thistransaction.

Trait Implementations

impl Clone for ManifestTransaction[src]

impl Debug for ManifestTransaction[src]

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

impl Eq for ManifestTransaction[src]

impl From<ManifestTransaction> for StoredArchive[src]

impl PartialEq<ManifestTransaction> for ManifestTransaction[src]

impl Serialize for ManifestTransaction[src]

impl StructuralEq for ManifestTransaction[src]

impl StructuralPartialEq for ManifestTransaction[src]

Auto Trait Implementations

impl RefUnwindSafe for ManifestTransaction

impl Send for ManifestTransaction

impl Sync for ManifestTransaction

impl Unpin for ManifestTransaction

impl UnwindSafe for ManifestTransaction

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: Deserialize<'de>, 

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized

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>, 

impl<T> WithSubscriber for T[src]