sc_network::service::traits

Trait 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>,
    );
}
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.

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>, )

Implementors§

Source§

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