pub struct DnaDef {
pub name: String,
pub network_seed: String,
pub properties: SerializedBytes,
pub origin_time: Timestamp,
pub integrity_zomes: Vec<(ZomeName, IntegrityZomeDef), Global>,
pub coordinator_zomes: Vec<(ZomeName, CoordinatorZomeDef), Global>,
}
Expand description
The definition of a DNA: the hash of this data is what produces the DnaHash.
Historical note: This struct was written before DnaManifest
appeared.
It is included as part of a DnaFile
. There is still a lot of code that uses
this type, but in function, it has mainly been superseded by DnaManifest
.
Hence, this type can basically be thought of as a fully validated, normalized
DnaManifest
Fields
name: String
The friendly “name” of a Holochain DNA.
network_seed: String
The network seed of a DNA is included in the computation of the DNA hash. The DNA hash in turn determines the network peers and the DHT, meaning that only peers with the same DNA hash of a shared DNA participate in the same network and co-create the DHT. To create a separate DHT for the DNA, a unique network seed can be specified.
properties: SerializedBytes
Any arbitrary application properties can be included in this object.
origin_time: Timestamp
The time used to denote the origin of the network, used to calculate time windows during gossip. All Action timestamps must come after this time.
integrity_zomes: Vec<(ZomeName, IntegrityZomeDef), Global>
A vector of zomes associated with your DNA.
coordinator_zomes: Vec<(ZomeName, CoordinatorZomeDef), Global>
A vector of zomes that do not affect
the DnaHash
.
Implementations
sourceimpl DnaDef
impl DnaDef
sourcepub fn unique_from_zomes(
integrity: Vec<Zome<IntegrityZomeDef>, Global>,
coordinator: Vec<Zome<CoordinatorZomeDef>, Global>
) -> DnaDef
pub fn unique_from_zomes(
integrity: Vec<Zome<IntegrityZomeDef>, Global>,
coordinator: Vec<Zome<CoordinatorZomeDef>, Global>
) -> DnaDef
Create a DnaDef with a random network seed, useful for testing
sourceimpl DnaDef
impl DnaDef
sourcepub fn get_integrity_zome(
&self,
zome_name: &ZomeName
) -> Result<Zome<IntegrityZomeDef>, ZomeError>
pub fn get_integrity_zome(
&self,
zome_name: &ZomeName
) -> Result<Zome<IntegrityZomeDef>, ZomeError>
Find an integrity zome from a ZomeName
.
sourcepub fn is_integrity_zome(&self, zome_name: &ZomeName) -> bool
pub fn is_integrity_zome(&self, zome_name: &ZomeName) -> bool
Check if a zome is an integrity zome.
sourcepub fn get_coordinator_zome(
&self,
zome_name: &ZomeName
) -> Result<Zome<CoordinatorZomeDef>, ZomeError>
pub fn get_coordinator_zome(
&self,
zome_name: &ZomeName
) -> Result<Zome<CoordinatorZomeDef>, ZomeError>
Find a coordinator zome from a ZomeName
.
sourcepub fn get_zome(&self, zome_name: &ZomeName) -> Result<Zome<ZomeDef>, ZomeError>
pub fn get_zome(&self, zome_name: &ZomeName) -> Result<Zome<ZomeDef>, ZomeError>
Find a any zome from a ZomeName
.
sourcepub fn get_all_coordinators(&self) -> Vec<Zome<CoordinatorZomeDef>, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn get_all_coordinators(&self) -> Vec<Zome<CoordinatorZomeDef>, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Get all the CoordinatorZome
s for this dna
sourcepub fn get_wasm_zome(&self, zome_name: &ZomeName) -> Result<&WasmZome, ZomeError>
pub fn get_wasm_zome(&self, zome_name: &ZomeName) -> Result<&WasmZome, ZomeError>
Return a Zome, error if not a WasmZome
sourcepub fn modify_phenotype(
&self,
network_seed: String,
properties: SerializedBytes
) -> DnaDef
pub fn modify_phenotype(
&self,
network_seed: String,
properties: SerializedBytes
) -> DnaDef
Change the “phenotype” of this DNA – the network seed and properties – while leaving the “genotype” of actual DNA code intact
Trait Implementations
sourceimpl<'arbitrary> Arbitrary<'arbitrary> for DnaDef
impl<'arbitrary> Arbitrary<'arbitrary> for DnaDef
sourcefn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<DnaDef, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<DnaDef, Error>
Generate an arbitrary value of Self
from the given unstructured data. Read more
sourcefn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<DnaDef, Error>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<DnaDef, Error>
Generate an arbitrary value of Self
from the entirety of the given
unstructured data. Read more
sourceimpl<'de> Deserialize<'de> for DnaDef
impl<'de> Deserialize<'de> for DnaDef
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<DnaDef, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<DnaDef, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl HashableContent for DnaDef
impl HashableContent for DnaDef
sourcefn hash_type(&self) -> <DnaDef as HashableContent>::HashType
fn hash_type(&self) -> <DnaDef as HashableContent>::HashType
The HashType which this content will be hashed to
sourcefn hashable_content(&self) -> HashableContentBytes
fn hashable_content(&self) -> HashableContentBytes
Return a subset of the content, either as SerializedBytes “content”, which will be used to compute the hash, or as an already precomputed hash which will be used directly Read more
sourceimpl PartialEq<DnaDef> for DnaDef
impl PartialEq<DnaDef> for DnaDef
sourceimpl Serialize for DnaDef
impl Serialize for DnaDef
sourcefn 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,
Serialize this value into the given Serde serializer. Read more
sourceimpl TryFrom<&DnaDef> for SerializedBytes
impl TryFrom<&DnaDef> for SerializedBytes
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
sourcefn try_from(t: &DnaDef) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: &DnaDef) -> Result<SerializedBytes, SerializedBytesError>
Performs the conversion.
sourceimpl TryFrom<DnaDef> for SerializedBytes
impl TryFrom<DnaDef> for SerializedBytes
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
sourcefn try_from(t: DnaDef) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: DnaDef) -> Result<SerializedBytes, SerializedBytesError>
Performs the conversion.
sourceimpl TryFrom<SerializedBytes> for DnaDef
impl TryFrom<SerializedBytes> for DnaDef
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
sourcefn try_from(sb: SerializedBytes) -> Result<DnaDef, SerializedBytesError>
fn try_from(sb: SerializedBytes) -> Result<DnaDef, SerializedBytesError>
Performs the conversion.
impl Eq for DnaDef
impl StructuralEq for DnaDef
impl StructuralPartialEq for DnaDef
Auto Trait Implementations
impl !RefUnwindSafe for DnaDef
impl Send for DnaDef
impl Sync for DnaDef
impl Unpin for DnaDef
impl !UnwindSafe for DnaDef
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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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 F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
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 Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
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, C> HashableContentExtSync<T> for C where
T: HashTypeSync,
C: HashableContent<HashType = T>,
impl<T, C> HashableContentExtSync<T> for C where
T: HashTypeSync,
C: HashableContent<HashType = T>,
sourcefn into_hashed(self) -> HoloHashed<C>
fn into_hashed(self) -> HoloHashed<C>
Move into a HoloHashed
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 SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
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 T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
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