pub struct AppBundle(/* private fields */);
Expand description
A bundle of an AppManifest and collection of DNAs
Implementations§
source§impl AppBundle
impl AppBundle
sourcepub async fn new<R>(
manifest: AppManifest,
resources: R,
root_dir: PathBuf
) -> Result<AppBundle, AppBundleError>
pub async fn new<R>( manifest: AppManifest, resources: R, root_dir: PathBuf ) -> Result<AppBundle, AppBundleError>
Create an AppBundle from a manifest and DNA files
sourcepub fn into_inner(self) -> Bundle<AppManifest>
pub fn into_inner(self) -> Bundle<AppManifest>
Convert to the inner Bundle
sourcepub fn get_all_dnas_from_store(
&self,
dna_store: &impl DnaStore
) -> HashMap<HoloHash<Dna>, DnaFile>
pub fn get_all_dnas_from_store( &self, dna_store: &impl DnaStore ) -> HashMap<HoloHash<Dna>, DnaFile>
Look up every installed_hash of every role, getting the DnaFiles from the DnaStore
sourcepub async fn resolve_cells(
self,
dna_store: &impl DnaStore,
agent: HoloHash<Agent>,
membrane_proofs: HashMap<String, Arc<SerializedBytes>>
) -> Result<AppRoleResolution, AppBundleError>
pub async fn resolve_cells( self, dna_store: &impl DnaStore, agent: HoloHash<Agent>, membrane_proofs: HashMap<String, Arc<SerializedBytes>> ) -> Result<AppRoleResolution, AppBundleError>
Given a partial list of already available DnaFiles, fetch the missing others via mr_bundle::Location resolution
Methods from Deref<Target = Bundle<AppManifest>>§
sourcepub async fn write_to_file(&self, path: &Path) -> Result<(), MrBundleError>
pub async fn write_to_file(&self, path: &Path) -> Result<(), MrBundleError>
Write a Bundle to a file
sourcepub async fn resolve(
&self,
location: &Location
) -> Result<Cow<'_, ResourceBytes>, MrBundleError>
pub async fn resolve( &self, location: &Location ) -> Result<Cow<'_, ResourceBytes>, MrBundleError>
Retrieve the bytes for a resource at a Location, downloading it if necessary
sourcepub async fn resolve_all(
&self
) -> Result<HashMap<Location, Cow<'_, ResourceBytes>>, MrBundleError>
pub async fn resolve_all( &self ) -> Result<HashMap<Location, Cow<'_, ResourceBytes>>, MrBundleError>
Return the full set of resources specified by this bundle’s manifest. References to bundled resources can be returned directly, while all others will be fetched from the filesystem or the network.
sourcepub async fn resolve_all_cloned(
&self
) -> Result<HashMap<Location, ResourceBytes>, MrBundleError>
pub async fn resolve_all_cloned( &self ) -> Result<HashMap<Location, ResourceBytes>, MrBundleError>
Resolve all resources, but with fully owned references
sourcepub fn bundled_resources(&self) -> &BTreeMap<PathBuf, ResourceBytes>
pub fn bundled_resources(&self) -> &BTreeMap<PathBuf, ResourceBytes>
Access the map of resources included in this bundle
Bundled resources are also accessible via resolve
or resolve_all
,
but using this method prevents a Clone
sourcepub fn encode(&self) -> Result<Vec<u8>, MrBundleError>
pub fn encode(&self) -> Result<Vec<u8>, MrBundleError>
An arbitrary and opaque encoding of the bundle data into a byte array
sourcepub fn find_root_dir(&self, path: &Path) -> Result<PathBuf, MrBundleError>
pub fn find_root_dir(&self, path: &Path) -> Result<PathBuf, MrBundleError>
Given that the Manifest is located at the given absolute path
, find
the absolute root directory for the “unpacked” Bundle directory.
Useful when “imploding” a directory into a bundle to determine the
default location of the generated Bundle file.
This will only be different than the Manifest path itself if the Manifest::path impl specifies a nested path.
Will return None if the path
does not actually end with the
manifest relative path, meaning that either the manifest file is
misplaced within the unpacked directory, or an incorrect path was
supplied.
sourcepub async fn unpack_yaml(
&self,
base_path: &Path,
force: bool
) -> Result<(), MrBundleError>
pub async fn unpack_yaml( &self, base_path: &Path, force: bool ) -> Result<(), MrBundleError>
Create a directory which contains the manifest as a YAML file,
and each resource written to its own file (as raw bytes)
The paths of the resources are specified by the paths of the bundle,
and the path of the manifest file is specified by the Manifest::path
trait method implementation of the M
type.
Trait Implementations§
source§impl AsRef<Bundle<AppManifest>> for AppBundle
impl AsRef<Bundle<AppManifest>> for AppBundle
source§fn as_ref(&self) -> &Bundle<AppManifest>
fn as_ref(&self) -> &Bundle<AppManifest>
source§impl<'de> Deserialize<'de> for AppBundle
impl<'de> Deserialize<'de> for AppBundle
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<AppBundle, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<AppBundle, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl Serialize for AppBundle
impl Serialize for AppBundle
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for AppBundle
impl RefUnwindSafe for AppBundle
impl Send for AppBundle
impl Sync for AppBundle
impl Unpin for AppBundle
impl UnwindSafe for AppBundle
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
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
source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.