SignedRole

Struct SignedRole 

Source
pub struct SignedRole<T> { /* private fields */ }
Expand description

A signed role, including its serialized form (buffer) which is meant to be written to file. The sha256 and length are calculated from this buffer and included in metadata for other roles, which makes it imperative that this buffer is what is written to disk.

Convenience methods are provided on SignedRepository to ensure that each role’s buffer is written correctly.

Implementations§

Source§

impl<T> SignedRole<T>
where T: Role + Serialize,

Source

pub async fn new( role: T, key_holder: &KeyHolder, keys: &[Box<dyn KeySource>], rng: &(dyn SecureRandom + Sync), ) -> Result<Self>

Creates a new SignedRole

Source

pub fn signed(&self) -> &Signed<T>

Provides access to the internal signed metadata object.

Source

pub fn buffer(&self) -> &Vec<u8>

Provides access to the internal buffer containing the serialized form of the signed role. This buffer should be used anywhere this role is written to file.

Source

pub fn sha256(&self) -> &[u8]

Provides the sha256 digest of the signed role.

Source

pub fn length(&self) -> &u64

Provides the length in bytes of the serialized representation of the signed role.

Source

pub async fn write<P>(&self, outdir: P, consistent_snapshot: bool) -> Result<()>
where P: AsRef<Path>,

Write the current role’s buffer to the given directory with the appropriate file name.

Source

pub fn add_old_signatures(self, old_signatures: Vec<Signature>) -> Result<Self>

Append the old signatures for root role

Trait Implementations§

Source§

impl<T: Clone> Clone for SignedRole<T>

Source§

fn clone(&self) -> SignedRole<T>

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
Source§

impl<T: Debug> Debug for SignedRole<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for SignedRole<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for SignedRole<T>
where T: RefUnwindSafe,

§

impl<T> Send for SignedRole<T>
where T: Send,

§

impl<T> Sync for SignedRole<T>
where T: Sync,

§

impl<T> Unpin for SignedRole<T>
where T: Unpin,

§

impl<T> UnwindSafe for SignedRole<T>
where T: UnwindSafe,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> 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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,