From 23ce278f8aa18ec6aa62029b55bc701f7c0d6fe5 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 10 Oct 2017 13:27:44 -0400 Subject: [PATCH] add removePeer to interface --- lbrynet/dht/datastore.py | 6 ++++++ lbrynet/dht/interface.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/lbrynet/dht/datastore.py b/lbrynet/dht/datastore.py index d67401240..a53942455 100644 --- a/lbrynet/dht/datastore.py +++ b/lbrynet/dht/datastore.py @@ -44,3 +44,9 @@ class DictDataStore(UserDict.DictMixin): def getPeersForBlob(self, key): if key in self._dict: return [val[0] for val in self._dict[key]] + + def removePeer(self, value): + for key in self._dict: + self._dict[key] = [val for val in self._dict[key] if val[0] != value] + if not self._dict[key]: + del self._dict[key] diff --git a/lbrynet/dht/interface.py b/lbrynet/dht/interface.py index 0648d6d21..67b4984a5 100644 --- a/lbrynet/dht/interface.py +++ b/lbrynet/dht/interface.py @@ -24,6 +24,9 @@ class IDataStore(Interface): def getPeersForBlob(self, key): pass + def removePeer(self, key): + pass + class IRoutingTable(Interface): """ Interface for RPC message translators/formatters