Kagome
Polkadot Runtime Engine in C++17
kagome::network::ReputationRepositoryImpl Class Reference

#include <reputation_repository_impl.hpp>

Inheritance diagram for kagome::network::ReputationRepositoryImpl:
Collaboration diagram for kagome::network::ReputationRepositoryImpl:

Public Member Functions

 ReputationRepositoryImpl (std::shared_ptr< libp2p::basic::Scheduler > scheduler)
 
Reputation reputation (const PeerId &peer_id) const override
 Current peer reputation. More...
 
Reputation change (const PeerId &peer_id, ReputationChange diff) override
 
Reputation changeForATime (const PeerId &peer_id, ReputationChange diff, std::chrono::seconds duration) override
 
- Public Member Functions inherited from kagome::network::ReputationRepository
virtual ~ReputationRepository ()=default
 

Private Member Functions

void tick ()
 

Private Attributes

std::shared_ptr< libp2p::basic::Scheduler > scheduler_
 
std::unordered_map< PeerId, Reputationreputation_table_
 
libp2p::basic::Scheduler::Handle tick_handler_
 
log::Logger log_
 

Additional Inherited Members

- Public Types inherited from kagome::network::ReputationRepository
using PeerId = libp2p::peer::PeerId
 

Detailed Description

Definition at line 20 of file reputation_repository_impl.hpp.

Constructor & Destructor Documentation

kagome::network::ReputationRepositoryImpl::ReputationRepositoryImpl ( std::shared_ptr< libp2p::basic::Scheduler >  scheduler)

Definition at line 16 of file reputation_repository_impl.cpp.

Member Function Documentation

Reputation kagome::network::ReputationRepositoryImpl::change ( const PeerId peer_id,
ReputationChange  diff 
)
overridevirtual

Change peer reputation by arbitrary amount of points

Parameters
peer_id- peer identifier
diff- reputation increment or decrement
Returns
- resulting peer reputation

Implements kagome::network::ReputationRepository.

Definition at line 31 of file reputation_repository_impl.cpp.

Reputation kagome::network::ReputationRepositoryImpl::changeForATime ( const PeerId peer_id,
ReputationChange  diff,
std::chrono::seconds  duration 
)
overridevirtual

Change peer reputation by arbitrary amount of points for a specified amount of time

Parameters
peer_id- peer identifier
difff- reputation increment or decrement
duration- amount of time to change peer reputation for
Returns
- resulting peer reputation

Implements kagome::network::ReputationRepository.

Definition at line 44 of file reputation_repository_impl.cpp.

Reputation kagome::network::ReputationRepositoryImpl::reputation ( const PeerId peer_id) const
overridevirtual

Current peer reputation.

Implements kagome::network::ReputationRepository.

Definition at line 25 of file reputation_repository_impl.cpp.

void kagome::network::ReputationRepositoryImpl::tick ( )
private

Definition at line 83 of file reputation_repository_impl.cpp.

Member Data Documentation

log::Logger kagome::network::ReputationRepositoryImpl::log_
private

Definition at line 43 of file reputation_repository_impl.hpp.

std::unordered_map<PeerId, Reputation> kagome::network::ReputationRepositoryImpl::reputation_table_
private

Definition at line 39 of file reputation_repository_impl.hpp.

std::shared_ptr<libp2p::basic::Scheduler> kagome::network::ReputationRepositoryImpl::scheduler_
private

Definition at line 38 of file reputation_repository_impl.hpp.

libp2p::basic::Scheduler::Handle kagome::network::ReputationRepositoryImpl::tick_handler_
private

Definition at line 41 of file reputation_repository_impl.hpp.


The documentation for this class was generated from the following files: