pub struct Conductor {
pub config: ConductorConfig,
/* private fields */
}
Expand description
A Conductor is a group of Cells
Fields§
§config: ConductorConfig
The config used to create this Conductor
Implementations§
source§impl Conductor
impl Conductor
Methods used by the ConductorHandle
sourcepub fn check_running(&self) -> ConductorResult<()>
pub fn check_running(&self) -> ConductorResult<()>
A gate to put at the top of public functions to ensure that work is not attempted after a shutdown has been issued
sourcepub fn detach_task_management(&self) -> Option<JoinHandle<TaskManagerResult>>
pub fn detach_task_management(&self) -> Option<JoinHandle<TaskManagerResult>>
Take ownership of the TaskManagerClient as well as the task which completes when all managed tasks have completed
sourcepub fn shutdown(&self) -> JoinHandle<TaskManagerResult> ⓘ
pub fn shutdown(&self) -> JoinHandle<TaskManagerResult> ⓘ
Broadcasts the shutdown signal to all managed tasks and returns a future to await for shutdown to complete.
source§impl Conductor
impl Conductor
sourcepub async fn add_app_interface(
self: Arc<Self>,
port: Either<u16, AppInterfaceId>
) -> ConductorResult<u16>
pub async fn add_app_interface( self: Arc<Self>, port: Either<u16, AppInterfaceId> ) -> ConductorResult<u16>
Spawn a new app interface task, register it with the TaskManager, and modify the conductor accordingly, based on the config passed in which is just a networking port number (or 0 to auto-select one). Returns the given or auto-chosen port number if giving an Ok Result
sourcepub fn get_arbitrary_admin_websocket_port(&self) -> Option<u16>
pub fn get_arbitrary_admin_websocket_port(&self) -> Option<u16>
Returns a port which is guaranteed to have a websocket listener with an Admin interface on it. Useful for specifying port 0 and letting the OS choose a free port.
sourcepub async fn list_app_interfaces(&self) -> ConductorResult<Vec<u16>>
pub async fn list_app_interfaces(&self) -> ConductorResult<Vec<u16>>
Give a list of networking ports taken up as running app interface tasks
source§impl Conductor
impl Conductor
sourcepub fn list_dnas(&self) -> Vec<DnaHash>
pub fn list_dnas(&self) -> Vec<DnaHash>
Get the list of hashes of installed Dnas in this Conductor
sourcepub fn get_dna_def(&self, hash: &DnaHash) -> Option<DnaDef>
pub fn get_dna_def(&self, hash: &DnaHash) -> Option<DnaDef>
Get a DnaDef
from the RibosomeStore
sourcepub fn get_dna_file(&self, hash: &DnaHash) -> Option<DnaFile>
pub fn get_dna_file(&self, hash: &DnaHash) -> Option<DnaFile>
Get a DnaFile
from the RibosomeStore
sourcepub fn get_entry_def(&self, key: &EntryDefBufferKey) -> Option<EntryDef>
pub fn get_entry_def(&self, key: &EntryDefBufferKey) -> Option<EntryDef>
Get an EntryDef
from the EntryDefBufferKey
sourcepub fn get_dna_definitions(
&self,
app: &InstalledApp
) -> ConductorResult<HashMap<CellId, DnaDefHashed>>
pub fn get_dna_definitions( &self, app: &InstalledApp ) -> ConductorResult<HashMap<CellId, DnaDefHashed>>
Create a hash map of all existing DNA definitions, mapped to cell ids.
sourcepub fn root_db_dir(&self) -> &DatabaseRootPath
pub fn root_db_dir(&self) -> &DatabaseRootPath
Get the root environment directory.
sourcepub fn keystore(&self) -> &MetaLairClient
pub fn keystore(&self) -> &MetaLairClient
Get the keystore.
sourcepub fn holochain_p2p(&self) -> &HolochainP2pRef
pub fn holochain_p2p(&self) -> &HolochainP2pRef
Get a reference to the conductor’s HolochainP2p.
sourcepub async fn register_dna(&self, dna: DnaFile) -> ConductorResult<()>
pub async fn register_dna(&self, dna: DnaFile) -> ConductorResult<()>
Install a DnaFile
in this Conductor
source§impl Conductor
impl Conductor
sourcepub async fn get_agent_infos(
&self,
cell_id: Option<CellId>
) -> ConductorApiResult<Vec<AgentInfoSigned>>
pub async fn get_agent_infos( &self, cell_id: Option<CellId> ) -> ConductorApiResult<Vec<AgentInfoSigned>>
Get signed agent info from the conductor
sourcepub async fn block(&self, input: Block) -> DatabaseResult<()>
pub async fn block(&self, input: Block) -> DatabaseResult<()>
Block some target.
sourcepub async fn unblock(&self, input: Block) -> DatabaseResult<()>
pub async fn unblock(&self, input: Block) -> DatabaseResult<()>
Unblock some target.
sourcepub async fn is_blocked(
&self,
input: BlockTargetId,
timestamp: Timestamp
) -> DatabaseResult<bool>
pub async fn is_blocked( &self, input: BlockTargetId, timestamp: Timestamp ) -> DatabaseResult<bool>
Check if some target is blocked.
sourcepub async fn list_wasm_host_functions(&self) -> ConductorApiResult<Vec<String>>
pub async fn list_wasm_host_functions(&self) -> ConductorApiResult<Vec<String>>
List all host functions provided by this conductor for wasms.
sourcepub async fn call_zome(
&self,
call: ZomeCall
) -> ConductorApiResult<ZomeCallResult>
pub async fn call_zome( &self, call: ZomeCall ) -> ConductorApiResult<ZomeCallResult>
Invoke a zome function on a Cell
sourcepub async fn easy_call_zome<I, O, Z, F>(
&self,
provenance: &AgentPubKey,
cap_secret: Option<CapSecret>,
cell_id: CellId,
zome_name: Z,
fn_name: F,
payload: I
) -> ConductorApiResult<O>where
FunctionName: From<F>,
ZomeName: From<Z>,
I: Serialize + Debug,
O: DeserializeOwned + Debug,
pub async fn easy_call_zome<I, O, Z, F>( &self, provenance: &AgentPubKey, cap_secret: Option<CapSecret>, cell_id: CellId, zome_name: Z, fn_name: F, payload: I ) -> ConductorApiResult<O>where FunctionName: From<F>, ZomeName: From<Z>, I: Serialize + Debug, O: DeserializeOwned + Debug,
Make a zome call with deserialization and some error unwrapping built in
source§impl Conductor
impl Conductor
sourcepub async fn install_app_bundle(
self: Arc<Self>,
payload: InstallAppPayload
) -> ConductorResult<StoppedApp>
pub async fn install_app_bundle( self: Arc<Self>, payload: InstallAppPayload ) -> ConductorResult<StoppedApp>
Install DNAs and set up Cells as specified by an AppBundle
sourcepub async fn uninstall_app(
self: Arc<Self>,
installed_app_id: &InstalledAppId
) -> ConductorResult<()>
pub async fn uninstall_app( self: Arc<Self>, installed_app_id: &InstalledAppId ) -> ConductorResult<()>
Uninstall an app
sourcepub async fn list_running_apps(&self) -> ConductorResult<Vec<InstalledAppId>>
pub async fn list_running_apps(&self) -> ConductorResult<Vec<InstalledAppId>>
List active AppIds
sourcepub async fn list_apps(
&self,
status_filter: Option<AppStatusFilter>
) -> ConductorResult<Vec<AppInfo>>
pub async fn list_apps( &self, status_filter: Option<AppStatusFilter> ) -> ConductorResult<Vec<AppInfo>>
List Apps with their information
sourcepub async fn list_running_apps_for_dependent_cell_id(
&self,
cell_id: &CellId
) -> ConductorResult<HashSet<InstalledAppId>>
pub async fn list_running_apps_for_dependent_cell_id( &self, cell_id: &CellId ) -> ConductorResult<HashSet<InstalledAppId>>
Get the IDs of all active installed Apps which use this Cell
sourcepub async fn find_cell_with_role_alongside_cell(
&self,
cell_id: &CellId,
role_name: &RoleName
) -> ConductorResult<Option<CellId>>
pub async fn find_cell_with_role_alongside_cell( &self, cell_id: &CellId, role_name: &RoleName ) -> ConductorResult<Option<CellId>>
Find the ID of the first active installed App which uses this Cell
sourcepub async fn list_running_apps_for_dependent_dna_hash(
&self,
dna_hash: &DnaHash
) -> ConductorResult<HashSet<InstalledAppId>>
pub async fn list_running_apps_for_dependent_dna_hash( &self, dna_hash: &DnaHash ) -> ConductorResult<HashSet<InstalledAppId>>
Get the IDs of all active installed Apps which use this Dna
sourcepub async fn get_app_info(
&self,
installed_app_id: &InstalledAppId
) -> ConductorResult<Option<AppInfo>>
pub async fn get_app_info( &self, installed_app_id: &InstalledAppId ) -> ConductorResult<Option<AppInfo>>
Get info about an installed App, regardless of status
source§impl Conductor
impl Conductor
sourcepub fn live_cell_ids(&self) -> HashSet<CellId>
pub fn live_cell_ids(&self) -> HashSet<CellId>
Iterator over only the cells which are fully “live”, meaning they have been fully initialized and are registered with the kitsune network layer. Generally used to handle conductor interface requests.
sourcepub fn running_cell_ids(
&self,
filter: Option<CellStatusFilter>
) -> HashSet<CellId>
pub fn running_cell_ids( &self, filter: Option<CellStatusFilter> ) -> HashSet<CellId>
List CellIds for Cells which match a status filter
source§impl Conductor
impl Conductor
sourcepub async fn create_clone_cell(
self: Arc<Self>,
payload: CreateCloneCellPayload
) -> ConductorResult<ClonedCell>
pub async fn create_clone_cell( self: Arc<Self>, payload: CreateCloneCellPayload ) -> ConductorResult<ClonedCell>
Create a new cell in an existing app based on an existing DNA.
Returns
A struct with the created cell’s clone id and cell id.
sourcepub async fn enable_clone_cell(
self: Arc<Self>,
payload: &EnableCloneCellPayload
) -> ConductorResult<ClonedCell>
pub async fn enable_clone_cell( self: Arc<Self>, payload: &EnableCloneCellPayload ) -> ConductorResult<ClonedCell>
Enable a disabled clone cell.
source§impl Conductor
impl Conductor
sourcepub async fn reconcile_cell_status_with_app_status(
self: Arc<Self>
) -> ConductorResult<CellStartupErrors>
pub async fn reconcile_cell_status_with_app_status( self: Arc<Self> ) -> ConductorResult<CellStartupErrors>
Adjust which cells are present in the Conductor (adding and removing as needed) to match the current reality of all app statuses.
- If a Cell is used by at least one Running app, then ensure it is added
- If a Cell is used by no running apps, then ensure it is removed.
sourcepub async fn enable_app(
self: Arc<Self>,
app_id: InstalledAppId
) -> ConductorResult<(InstalledApp, CellStartupErrors)>
pub async fn enable_app( self: Arc<Self>, app_id: InstalledAppId ) -> ConductorResult<(InstalledApp, CellStartupErrors)>
Enable an app
sourcepub async fn disable_app(
self: Arc<Self>,
app_id: InstalledAppId,
reason: DisabledAppReason
) -> ConductorResult<InstalledApp>
pub async fn disable_app( self: Arc<Self>, app_id: InstalledAppId, reason: DisabledAppReason ) -> ConductorResult<InstalledApp>
Disable an app
sourcepub async fn start_app(
self: Arc<Self>,
app_id: InstalledAppId
) -> ConductorResult<InstalledApp>
pub async fn start_app( self: Arc<Self>, app_id: InstalledAppId ) -> ConductorResult<InstalledApp>
Start an app
source§impl Conductor
impl Conductor
sourcepub async fn grant_zome_call_capability(
&self,
payload: GrantZomeCallCapabilityPayload
) -> ConductorApiResult<()>
pub async fn grant_zome_call_capability( &self, payload: GrantZomeCallCapabilityPayload ) -> ConductorApiResult<()>
Grant a zome call capability for a cell
sourcepub async fn dump_cell_state(
&self,
cell_id: &CellId
) -> ConductorApiResult<String>
pub async fn dump_cell_state( &self, cell_id: &CellId ) -> ConductorApiResult<String>
Create a JSON dump of the cell’s state
sourcepub async fn dump_full_cell_state(
&self,
cell_id: &CellId,
dht_ops_cursor: Option<u64>
) -> ConductorApiResult<FullStateDump>
pub async fn dump_full_cell_state( &self, cell_id: &CellId, dht_ops_cursor: Option<u64> ) -> ConductorApiResult<FullStateDump>
Create a comprehensive structured dump of a cell’s state
sourcepub async fn dump_network_metrics(
&self,
dna_hash: Option<DnaHash>
) -> ConductorApiResult<String>
pub async fn dump_network_metrics( &self, dna_hash: Option<DnaHash> ) -> ConductorApiResult<String>
JSON dump of network metrics
sourcepub async fn dump_network_stats(&self) -> ConductorApiResult<String>
pub async fn dump_network_stats(&self) -> ConductorApiResult<String>
JSON dump of backend network stats
sourcepub async fn add_agent_infos(
&self,
agent_infos: Vec<AgentInfoSigned>
) -> ConductorApiResult<()>
pub async fn add_agent_infos( &self, agent_infos: Vec<AgentInfoSigned> ) -> ConductorApiResult<()>
Add signed agent info to the conductor
sourcepub async fn graft_records_onto_source_chain(
self: Arc<Self>,
cell_id: CellId,
validate: bool,
records: Vec<Record>
) -> ConductorApiResult<()>
pub async fn graft_records_onto_source_chain( self: Arc<Self>, cell_id: CellId, validate: bool, records: Vec<Record> ) -> ConductorApiResult<()>
Inject records into a source chain for a cell. If the records form a chain segment that can be “grafted” onto the existing chain, it will be. Otherwise, a new chain will be formed using the specified records.
sourcepub async fn update_coordinators(
&self,
hash: &DnaHash,
coordinator_zomes: CoordinatorZomes,
wasms: Vec<DnaWasm>
) -> ConductorResult<()>
pub async fn update_coordinators( &self, hash: &DnaHash, coordinator_zomes: CoordinatorZomes, wasms: Vec<DnaWasm> ) -> ConductorResult<()>
Update coordinator zomes on an existing dna.
source§impl Conductor
impl Conductor
sourcepub fn signal_broadcaster(&self) -> SignalBroadcaster
pub fn signal_broadcaster(&self) -> SignalBroadcaster
Access to the signal broadcast channel, to create new subscriptions
sourcepub async fn post_commit_permit(
&self
) -> Result<OwnedPermit<PostCommitArgs>, SendError<()>>
pub async fn post_commit_permit( &self ) -> Result<OwnedPermit<PostCommitArgs>, SendError<()>>
Get the post commit sender.
sourcepub fn get_config(&self) -> &ConductorConfig
pub fn get_config(&self) -> &ConductorConfig
Get the conductor config
sourcepub fn task_manager(&self) -> TaskManagerClient
pub fn task_manager(&self) -> TaskManagerClient
Get a TaskManagerClient
Auto Trait Implementations§
impl !RefUnwindSafe for Conductor
impl Send for Conductor
impl Sync for Conductor
impl Unpin for Conductor
impl !UnwindSafe for Conductor
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
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
§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>
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> ⓘ
§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 more§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).§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.