Module holochain::conductor::handle [−][src]
Expand description
Defines ConductorHandle, a lightweight cloneable reference to a Conductor with a limited public interface.
A ConductorHandle can be produced via [Conductor::into_handle]
async fn async_main () {
use holochain_state::test_utils::test_environments;
use holochain::conductor::{Conductor, ConductorBuilder, ConductorHandle};
let envs = test_environments();
let handle: ConductorHandle = ConductorBuilder::new()
.test(&envs, &[])
.await
.unwrap();
// handles are cloneable
let handle2 = handle.clone();
assert_eq!(handle.list_dnas(), vec![]);
handle.shutdown();
The purpose of this handle is twofold:
First, it specifies how to synchronize read/write access to a single Conductor across multiple references. The various Conductor APIs - [CellConductorApi], [AdminInterfaceApi], and [AppInterfaceApi], use a ConductorHandle as their sole method of interaction with a Conductor.
Secondly, it hides the concrete type of the Conductor behind a dyn Trait. The Conductor is a central point of configuration, and has several type parameters, used to modify functionality including specifying mock types for testing. If we did not have a way of hiding this type genericity, code which interacted with the Conductor would also have to be highly generic.
Modules
Structs
The current “production” implementation of a ConductorHandle. The implementation specifies how read/write access to the Conductor should be synchronized across multiple concurrent Handles.
Base trait for ConductorHandle
Traits
Base trait for ConductorHandle
Type Definitions
A list of Cells which failed to start, and why
A handle to the Conductor that can easily be passed around and cheaply cloned