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>
remove after app bundles become standard; use DnaBundle instead
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>
remove after app bundles become standard; use DnaBundle instead
Render this dna_file as bytecode to send over the wire, or store in a file.
sourcepub fn modify_phenotype(
&self,
network_seed: NetworkSeed,
properties: YamlProperties
) -> DnaResult<Self>
pub fn modify_phenotype(
&self,
network_seed: NetworkSeed,
properties: YamlProperties
) -> DnaResult<Self>
Change the “phenotype” of this DNA – the network seed and properties – while leaving the “genotype” of 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<DnaFile> for DnaFile
impl PartialEq<DnaFile> for DnaFile
sourceimpl TryFrom<&DnaFile> for SerializedBytes
impl TryFrom<&DnaFile> for SerializedBytes
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
sourcefn try_from(t: &DnaFile) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: &DnaFile) -> Result<SerializedBytes, SerializedBytesError>
Performs the conversion.
sourceimpl TryFrom<DnaFile> for SerializedBytes
impl TryFrom<DnaFile> for SerializedBytes
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
sourcefn try_from(t: DnaFile) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: DnaFile) -> Result<SerializedBytes, SerializedBytesError>
Performs the conversion.
sourceimpl TryFrom<SerializedBytes> for DnaFile
impl TryFrom<SerializedBytes> for DnaFile
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
sourcefn try_from(sb: SerializedBytes) -> Result<DnaFile, SerializedBytesError>
fn try_from(sb: SerializedBytes) -> Result<DnaFile, SerializedBytesError>
Performs the conversion.
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 = ()
The archived version of the pointer metadata for this type.
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Mutably borrows from an owned value. Read more
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>
Deserializes using the given deserializer
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
Compare self to 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>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
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>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if 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
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more