Kagome
Polkadot Runtime Engine in C++17
reputation_repository.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_NETWORK_REPUTATIONREPOSITORY
7 #define KAGOME_NETWORK_REPUTATIONREPOSITORY
8 
9 #include <chrono>
10 
11 #include <libp2p/peer/peer_id.hpp>
12 
14 
15 namespace kagome::network {
16 
17  using Reputation = std::int32_t;
18 
23  public:
25 
26  virtual ~ReputationRepository() = default;
27 
29  virtual Reputation reputation(const PeerId &peer_id) const = 0;
30 
37  virtual Reputation change(const PeerId &peer_id, ReputationChange diff) = 0;
38 
47  virtual Reputation changeForATime(const PeerId &peer_id,
48  ReputationChange diff,
49  std::chrono::seconds duration) = 0;
50  };
51 
52 } // namespace kagome::network
53 
54 #endif // KAGOME_NETWORK_REPUTATIONREPOSITORY
virtual Reputation change(const PeerId &peer_id, ReputationChange diff)=0
virtual Reputation reputation(const PeerId &peer_id) const =0
Current peer reputation.
virtual Reputation changeForATime(const PeerId &peer_id, ReputationChange diff, std::chrono::seconds duration)=0
libp2p::peer::PeerId PeerId
std::int32_t Reputation