1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
//! Cells can be cloned to create new cells with the different properties.
use crate::cell::{CellId, CloneId};
use derive_more::Display;
use holo_hash::DnaHash;
use holochain_integrity_types::DnaModifiers;
/// The arguments to create a clone of an existing cell.
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CreateCloneCellInput {
/// The id of the cell to clone.
pub cell_id: CellId,
/// Modifiers to set for the new cell.
/// At least one of the modifiers must be set to obtain a distinct hash for
/// the clone cell's DNA.
#[cfg(feature = "properties")]
pub modifiers: holochain_integrity_types::DnaModifiersOpt<crate::properties::YamlProperties>,
/// Optionally set a proof of membership for the clone cell
pub membrane_proof: Option<holochain_integrity_types::MembraneProof>,
/// Optionally a name for the DNA clone
pub name: Option<String>,
}
/// Cloned cell that was created from a provisioned cell at runtime.
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ClonedCell {
/// The cell's identifying data
pub cell_id: CellId,
/// A conductor-local clone identifier
pub clone_id: CloneId,
/// The hash of the DNA that this cell was instantiated from
pub original_dna_hash: DnaHash,
/// The DNA modifiers that were used to instantiate this clone cell
pub dna_modifiers: DnaModifiers,
/// The name the cell was instantiated with
pub name: String,
/// Whether or not the cell is running
pub enabled: bool,
}
/// Ways of specifying a clone cell.
#[derive(Clone, Debug, Display, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum CloneCellId {
/// Clone id consisting of role name and clone index.
CloneId(CloneId),
/// Cell id consisting of DNA hash and agent pub key.
CellId(CellId),
}
/// Arguments to specify the clone cell to be disabled.
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct DisableCloneCellInput {
/// The clone id or cell id of the clone cell
pub clone_cell_id: CloneCellId,
}
/// Arguments to specify the clone cell to be enabled.
pub type EnableCloneCellInput = DisableCloneCellInput;
/// Arguments to delete a disabled clone cell of an app.
pub type DeleteCloneCellInput = DisableCloneCellInput;