pub struct DnaFile { /* private fields */ }
Expand description
Represents a full DNA, including DnaDef and WebAssembly bytecode.
Historical note: This struct was written before DnaBundle
was introduced.
This used to be our file representation of a full distributable DNA.
That function has been superseded by DnaBundle
, but we use this type
widely, so there is simply a way to convert from DnaBundle
to DnaFile
.
TODO: Once we remove the InstallApp
command which accepts a DnaFile
,
we should remove the Serialize impl on this type, and perhaps rename
to indicate that this is simply a validated, fully-formed DnaBundle
(i.e. all Wasms are bundled and immediately available, not remote.)
Implementations§
source§impl DnaFile
impl DnaFile
sourcepub async fn new(
dna: DnaDef,
wasm: impl IntoIterator<Item = DnaWasm>
) -> DnaFile
pub async fn new( dna: DnaDef, wasm: impl IntoIterator<Item = DnaWasm> ) -> DnaFile
Construct a new DnaFile instance.
sourcepub async fn update_coordinators(
&mut self,
coordinator_zomes: Vec<(ZomeName, CoordinatorZomeDef)>,
wasms: Vec<DnaWasm>
) -> Result<Vec<HoloHash<Wasm>>, DnaError>
pub async fn update_coordinators( &mut self, coordinator_zomes: Vec<(ZomeName, CoordinatorZomeDef)>, wasms: Vec<DnaWasm> ) -> Result<Vec<HoloHash<Wasm>>, DnaError>
Update coordinator zomes for this dna.
sourcepub fn from_parts(dna: HoloHashed<DnaDef>, code: WasmMap) -> DnaFile
pub fn from_parts(dna: HoloHashed<DnaDef>, code: WasmMap) -> DnaFile
Construct a DnaFile from its constituent parts
sourcepub fn dna(&self) -> &HoloHashed<DnaDef>
pub fn dna(&self) -> &HoloHashed<DnaDef>
The DnaDef along with its hash
sourcepub fn verify_hash(&self) -> Result<(), DnaError>
pub fn verify_hash(&self) -> Result<(), DnaError>
Verify that the DNA hash in the file matches the DnaDef
sourcepub async fn from_file_content(data: &[u8]) -> Result<DnaFile, DnaError>
👎Deprecated: remove after app bundles become standard; use DnaBundle instead
pub async fn from_file_content(data: &[u8]) -> Result<DnaFile, DnaError>
Load dna_file bytecode into this rust struct.
sourcepub async fn with_properties(self, properties: SerializedBytes) -> DnaFile
pub async fn with_properties(self, properties: SerializedBytes) -> DnaFile
Transform this DnaFile into a new DnaFile with different properties and, hence, a different DnaHash.
sourcepub async fn with_network_seed(self, network_seed: String) -> DnaFile
pub async fn with_network_seed(self, network_seed: String) -> DnaFile
Transform this DnaFile into a new DnaFile with a different network seed and, hence, a different DnaHash.
sourcepub fn code(&self) -> &BTreeMap<HoloHash<Wasm>, DnaWasm>
pub fn code(&self) -> &BTreeMap<HoloHash<Wasm>, DnaWasm>
The bytes of the WASM zomes referenced in the Dna portion.
sourcepub fn get_wasm_for_zome(
&self,
zome_name: &ZomeName
) -> Result<&DnaWasm, DnaError>
pub fn get_wasm_for_zome( &self, zome_name: &ZomeName ) -> Result<&DnaWasm, DnaError>
Fetch the Webassembly byte code for a zome.
sourcepub async fn to_file_content(&self) -> Result<Vec<u8>, DnaError>
👎Deprecated: remove after app bundles become standard; use DnaBundle instead
pub async fn to_file_content(&self) -> Result<Vec<u8>, DnaError>
Render this dna_file as bytecode to send over the wire, or store in a file.
sourcepub fn update_modifiers(&self, dna_modifiers: DnaModifiersOpt) -> DnaFile
pub fn update_modifiers(&self, dna_modifiers: DnaModifiersOpt) -> DnaFile
Change the DNA modifiers – the network seed, origin time and properties – while leaving the actual DNA code intact.
Trait Implementations§
source§impl<'de> Deserialize<'de> for DnaFile
impl<'de> Deserialize<'de> for DnaFile
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<DnaFile, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<DnaFile, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for DnaFile
impl PartialEq for DnaFile
source§impl Serialize for DnaFile
impl Serialize for DnaFile
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,
source§impl TryFrom<&DnaFile> for SerializedBytes
impl TryFrom<&DnaFile> for SerializedBytes
§type Error = SerializedBytesError
type Error = SerializedBytesError
source§fn try_from(t: &DnaFile) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: &DnaFile) -> Result<SerializedBytes, SerializedBytesError>
source§impl TryFrom<DnaFile> for SerializedBytes
impl TryFrom<DnaFile> for SerializedBytes
§type Error = SerializedBytesError
type Error = SerializedBytesError
source§fn try_from(t: DnaFile) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: DnaFile) -> Result<SerializedBytes, SerializedBytesError>
source§impl TryFrom<SerializedBytes> for DnaFile
impl TryFrom<SerializedBytes> for DnaFile
§type Error = SerializedBytesError
type Error = SerializedBytesError
source§fn try_from(sb: SerializedBytes) -> Result<DnaFile, SerializedBytesError>
fn try_from(sb: SerializedBytes) -> Result<DnaFile, SerializedBytesError>
impl Eq for DnaFile
impl StructuralPartialEq for DnaFile
Auto Trait Implementations§
impl !RefUnwindSafe for DnaFile
impl Send for DnaFile
impl Sync for DnaFile
impl Unpin for DnaFile
impl !UnwindSafe for DnaFile
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.