[][src]Trait holochain_net::p2p_network::P2pNetwork

pub trait P2pNetwork {
    fn exec_raw_json(
        &mut self,
        input: &str,
        cb: Option<ApiFnJson>
    ) -> Result<String, Error>;
fn exec_raw_bin(
        &mut self,
        input: &[u8],
        cb: Option<ApiFnBin>
    ) -> Result<Vec<u8>, Error>; fn get_state(&mut self) -> Result<P2pNetworkState, Error> { ... }
fn get_default_config(&mut self) -> Result<String, Error> { ... }
fn set_config(&mut self, config: &str) -> Result<(), Error> { ... }
fn track_app(
        &mut self,
        genome_hash: &GenomeHash,
        sign_pubkey: &[u8; 32],
        enc_pubkey: &[u8; 32]
    ) -> Result<(), Error> { ... }
fn untrack_app(&mut self, genome_hash: &GenomeHash) -> Result<(), Error> { ... }
fn set_app_signature_callback(
        &mut self,
        genome_hash: &GenomeHash,
        cb: ApiFnBin
    ) -> Result<(), Error> { ... }
fn set_app_encryption_callback(
        &mut self,
        genome_hash: &GenomeHash,
        cb: ApiFnBin
    ) -> Result<(), Error> { ... }
fn dht_set_on_hold_callback(
        &mut self,
        cb: DhtHoldCallback
    ) -> Result<(), Error> { ... }
fn dht_publish(
        &mut self,
        genome_hash: &GenomeHash,
        data: &str
    ) -> Result<(), Error> { ... } }

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

This is the main backbone api throughput function that must be implemented by structs implementing this trait

This is similar to exec_raw_json, but permits binary data transfer

Provided Methods

This call should return a state within:

  • pending
  • need_config
  • running

This call should return a json configuration blob for the p2p module

pass along configuration to the network module

setup an app to be synced on the p2p network side

stop syncing an app on the p2p network side

set a signature callback for an app

set an encryption callback for an app

when the network asks us to store a bit of DHT data we first need to make sure it is valid

we want to publish a bit of DHT data

Implementors