Struct holochain_types::dna::DnaFile
source · [−]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
sourceimpl DnaFile
impl DnaFile
sourcepub async fn new(
dna: DnaDef,
wasm: impl IntoIterator<Item = DnaWasm>
) -> Result<Self, DnaError>
pub async fn new(
dna: DnaDef,
wasm: impl IntoIterator<Item = DnaWasm>
) -> Result<Self, DnaError>
Construct a new DnaFile instance.
sourcepub async fn update_coordinators(
&mut self,
coordinator_zomes: CoordinatorZomes,
wasms: Vec<DnaWasm>
) -> Result<Vec<WasmHash>, DnaError>
pub async fn update_coordinators(
&mut self,
coordinator_zomes: CoordinatorZomes,
wasms: Vec<DnaWasm>
) -> Result<Vec<WasmHash>, DnaError>
Update coordinator zomes for this dna.
sourcepub fn from_parts(dna: DnaDefHashed, code: WasmMap) -> Self
pub fn from_parts(dna: DnaDefHashed, code: WasmMap) -> Self
Construct a DnaFile from its constituent parts
sourcepub fn dna(&self) -> &DnaDefHashed
pub fn dna(&self) -> &DnaDefHashed
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<Self, DnaError>
👎Deprecated: remove after app bundles become standard; use DnaBundle instead
pub async fn from_file_content(data: &[u8]) -> Result<Self, DnaError>
Load dna_file bytecode into this rust struct.
sourcepub async fn with_properties(
self,
properties: SerializedBytes
) -> Result<Self, DnaError>
pub async fn with_properties(
self,
properties: SerializedBytes
) -> Result<Self, DnaError>
Transform this DnaFile into a new DnaFile with different properties and, hence, a different DnaHash.
sourcepub async fn with_network_seed(
self,
network_seed: NetworkSeed
) -> Result<Self, DnaError>
pub async fn with_network_seed(
self,
network_seed: NetworkSeed
) -> Result<Self, DnaError>
Transform this DnaFile into a new DnaFile with a different network seed and, hence, a different DnaHash.
sourcepub fn code(&self) -> &BTreeMap<WasmHash, DnaWasm>
pub fn code(&self) -> &BTreeMap<WasmHash, 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) -> Self
pub fn update_modifiers(&self, dna_modifiers: DnaModifiersOpt) -> Self
Change the DNA modifiers – the network seed, origin time and properties – while leaving the actual DNA code intact.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for DnaFile
impl<'de> Deserialize<'de> for DnaFile
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
sourceimpl TryFrom<&DnaFile> for SerializedBytes
impl TryFrom<&DnaFile> for SerializedBytes
type Error = SerializedBytesError
type Error = SerializedBytesError
sourcefn try_from(t: &DnaFile) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: &DnaFile) -> Result<SerializedBytes, SerializedBytesError>
sourceimpl TryFrom<DnaFile> for SerializedBytes
impl TryFrom<DnaFile> for SerializedBytes
type Error = SerializedBytesError
type Error = SerializedBytesError
sourcefn try_from(t: DnaFile) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: DnaFile) -> Result<SerializedBytes, SerializedBytesError>
sourceimpl TryFrom<SerializedBytes> for DnaFile
impl TryFrom<SerializedBytes> for DnaFile
type Error = SerializedBytesError
type Error = SerializedBytesError
sourcefn try_from(sb: SerializedBytes) -> Result<DnaFile, SerializedBytesError>
fn try_from(sb: SerializedBytes) -> Result<DnaFile, SerializedBytesError>
impl Eq for DnaFile
impl StructuralEq 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
impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.impl<T> FutureExt for T
impl<T> FutureExt for T
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read morefn 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).fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.