[−][src]Trait holochain_net::p2p_network::P2pNetwork
Represents a connection to a peer to peer network module
On initial instantiation, only calling get_state
is valid
see P2pNetorkState for usage
Required Methods
fn exec_raw_json(
&mut self,
input: &str,
cb: Option<ApiFnJson>
) -> Result<String, Error>
&mut self,
input: &str,
cb: Option<ApiFnJson>
) -> Result<String, Error>
This is the main backbone api throughput function that must be implemented by structs implementing this trait
fn exec_raw_bin(
&mut self,
input: &[u8],
cb: Option<ApiFnBin>
) -> Result<Vec<u8>, Error>
&mut self,
input: &[u8],
cb: Option<ApiFnBin>
) -> Result<Vec<u8>, Error>
This is similar to exec_raw_json
, but permits binary data transfer
Provided Methods
fn get_state(&mut self) -> Result<P2pNetworkState, Error>
This call should return a state within:
pending
need_config
running
fn get_default_config(&mut self) -> Result<String, Error>
This call should return a json configuration blob for the p2p module
fn set_config(&mut self, config: &str) -> Result<(), Error>
pass along configuration to the network module
fn track_app(
&mut self,
genome_hash: &GenomeHash,
sign_pubkey: &[u8; 32],
enc_pubkey: &[u8; 32]
) -> Result<(), Error>
&mut self,
genome_hash: &GenomeHash,
sign_pubkey: &[u8; 32],
enc_pubkey: &[u8; 32]
) -> Result<(), Error>
setup an app to be synced on the p2p network side
fn untrack_app(&mut self, genome_hash: &GenomeHash) -> Result<(), Error>
stop syncing an app on the p2p network side
fn set_app_signature_callback(
&mut self,
genome_hash: &GenomeHash,
cb: ApiFnBin
) -> Result<(), Error>
&mut self,
genome_hash: &GenomeHash,
cb: ApiFnBin
) -> Result<(), Error>
set a signature callback for an app
fn set_app_encryption_callback(
&mut self,
genome_hash: &GenomeHash,
cb: ApiFnBin
) -> Result<(), Error>
&mut self,
genome_hash: &GenomeHash,
cb: ApiFnBin
) -> Result<(), Error>
set an encryption callback for an app
fn dht_set_on_hold_callback(&mut self, cb: DhtHoldCallback) -> Result<(), Error>
when the network asks us to store a bit of DHT data we first need to make sure it is valid
fn dht_publish(
&mut self,
genome_hash: &GenomeHash,
data: &str
) -> Result<(), Error>
&mut self,
genome_hash: &GenomeHash,
data: &str
) -> Result<(), Error>
we want to publish a bit of DHT data