referrerpolicy=no-referrer-when-downgrade

Trait sc_network::service::traits::NetworkDHTProvider

source ·
pub trait NetworkDHTProvider {
    // Required methods
    fn get_value(&self, key: &KademliaKey);
    fn put_value(&self, key: KademliaKey, value: Vec<u8>);
    fn put_record_to(
        &self,
        record: Record,
        peers: HashSet<PeerId>,
        update_local_storage: bool,
    );
    fn store_record(
        &self,
        key: KademliaKey,
        value: Vec<u8>,
        publisher: Option<PeerId>,
        expires: Option<Instant>,
    );
    fn start_providing(&self, key: KademliaKey);
    fn stop_providing(&self, key: KademliaKey);
    fn get_providers(&self, key: KademliaKey);
}
Expand description

Provides access to the networking DHT.

Required Methods§

source

fn get_value(&self, key: &KademliaKey)

Start getting a value from the DHT.

source

fn put_value(&self, key: KademliaKey, value: Vec<u8>)

Start putting a value in the DHT.

source

fn put_record_to( &self, record: Record, peers: HashSet<PeerId>, update_local_storage: bool, )

Start putting the record to peers.

If update_local_storage is true the local storage is udpated as well.

source

fn store_record( &self, key: KademliaKey, value: Vec<u8>, publisher: Option<PeerId>, expires: Option<Instant>, )

Store a record in the DHT memory store.

source

fn start_providing(&self, key: KademliaKey)

Register this node as a provider for key on the DHT.

source

fn stop_providing(&self, key: KademliaKey)

Deregister this node as a provider for key on the DHT.

source

fn get_providers(&self, key: KademliaKey)

Start getting the list of providers for key on the DHT.

Implementations on Foreign Types§

source§

impl<T> NetworkDHTProvider for Arc<T>

source§

fn get_value(&self, key: &KademliaKey)

source§

fn put_value(&self, key: KademliaKey, value: Vec<u8>)

source§

fn put_record_to( &self, record: Record, peers: HashSet<PeerId>, update_local_storage: bool, )

source§

fn store_record( &self, key: KademliaKey, value: Vec<u8>, publisher: Option<PeerId>, expires: Option<Instant>, )

source§

fn start_providing(&self, key: KademliaKey)

source§

fn stop_providing(&self, key: KademliaKey)

source§

fn get_providers(&self, key: KademliaKey)

Implementors§

source§

impl<B, H> NetworkDHTProvider for NetworkService<B, H>
where B: BlockT + 'static, H: ExHashT,