Package

Struct Package 

Source
pub struct Package { /* private fields */ }
Expand description

A package generated by a PackageBuilder, suitable for assembling into a TUF repository.

Implementations§

Source§

impl Package

Source

pub fn hash(&self) -> &Hash

The merkle root of the package’s meta.far.

Source

pub fn meta_far(&self) -> Result<File>

The package’s meta.far.

Source

pub fn name(&self) -> &PackageName

The name of the package.

Source

pub fn fuchsia_url(&self) -> PinnedAbsolutePackageUrl

The pinned fuchsia-pkg url of the package on fuchsia.com.

Source

pub fn artifacts(&self) -> &Utf8Path

The directory containing the blobs contained in the package, including the meta.far.

Source

pub async fn identity() -> Result<Self, Error>

Builds and returns the package located at “/pkg” in the current namespace.

Source

pub async fn from_dir(root: impl AsRef<Path>) -> Result<Self, Error>

Builds and returns the package located at the given path in the current namespace.

Source

pub fn meta_contents(&self) -> Result<MetaContents, Error>

Returns the parsed contents of the meta/contents file.

Source

pub fn meta_subpackages(&self) -> Result<MetaSubpackages, Error>

Returns the parsed contents of the subpackages manifest.

Source

pub fn list_blobs(&self) -> BTreeSet<Hash>

Returns a set of all unique blobs contained in this package, including meta.far and subpackage blobs.

§Panics

If either there are unknown subpackage blobs or there is an error reading meta/contents.

Source

pub fn content_blob_files(&self) -> impl Iterator<Item = BlobFile>

Returns an iterator of merkle/File pairs for each content blob in the package.

Does not include the meta.far, see meta_far() and meta_far_merkle_root(), instead.

Source

pub fn contents(&self) -> (BlobContents, HashMap<Hash, Vec<u8>>)

Returns a tuple of the contents of the meta far and the contents of all content blobs in the package.

Source

pub fn content_and_subpackage_blobs(&self) -> Option<HashMap<Hash, Vec<u8>>>

Returns None if this Package has subpackages but doesn’t have the blobs.

Source

pub async fn write_to_blobfs_ignore_subpackages( &self, blobfs_ramdisk: &BlobfsRamdisk, )

Writes the meta.far and all content blobs to blobfs. Does not write the subpackage blobs, if any.

Source

pub async fn write_to_blobfs(&self, blobfs_ramdisk: &BlobfsRamdisk)

Writes the meta.far and all content and subpackage blobs to blobfs.

Source

pub async fn verify_contents( &self, dir: &DirectoryProxy, ) -> Result<(), VerificationError>

Verifies that the given directory serves the contents of this package.

Source

pub fn subpackage_blobs(&self) -> Option<&HashMap<Hash, Vec<u8>>>

The blobs used by all of the subpackages of this package (recursively). If None, this Package has subpackages but does not have the blobs needed by those subpackages.

Trait Implementations§

Source§

impl Debug for Package

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> InstanceFromServiceTransport<T> for T

§

fn from_service_transport(handle: T) -> T

Converts the given service transport handle of type T to [Self]
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> IntoAny for T
where T: 'static + Send + Sync,

§

fn into_any(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Cast the given object into a dyn std::any::Any.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T, U> IntoExt<U> for T
where U: FromExt<T>,

§

fn into_ext(self) -> U

Performs the conversion.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T, U> TryIntoExt<U> for T
where U: TryFromExt<T>,

§

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

§

fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>

Tries to perform the conversion.
§

impl<T> Unless for T

§

fn unless(self, option: Option<T>) -> T

§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> OnRootDirDrop for T
where T: Send + Sync + Debug,

§

impl<E> RunsTransport<Mpsc> for E

§

impl<E> RunsTransport<Mpsc> for E
where E: RunsTransport<Mpsc>,