forked from LBRYCommunity/lbry-sdk
add get_all_verified_blobs
This commit is contained in:
parent
47fae977dd
commit
710e549c03
2 changed files with 21 additions and 4 deletions
|
@ -67,6 +67,9 @@ class BlobManager(DHTHashSupplier):
|
||||||
def blob_paid_for(self, blob_hash, amount):
|
def blob_paid_for(self, blob_hash, amount):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def get_all_verified_blobs(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class DiskBlobManager(BlobManager):
|
class DiskBlobManager(BlobManager):
|
||||||
"""This class stores blobs on the hard disk"""
|
"""This class stores blobs on the hard disk"""
|
||||||
|
@ -177,6 +180,11 @@ class DiskBlobManager(BlobManager):
|
||||||
def check_consistency(self):
|
def check_consistency(self):
|
||||||
return self._check_consistency()
|
return self._check_consistency()
|
||||||
|
|
||||||
|
def get_all_verified_blobs(self):
|
||||||
|
d = self._get_all_verified_blob_hashes()
|
||||||
|
d.addCallback(self.completed_blobs)
|
||||||
|
return d
|
||||||
|
|
||||||
def _manage(self):
|
def _manage(self):
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
|
||||||
|
@ -462,6 +470,10 @@ class TempBlobManager(BlobManager):
|
||||||
blobs = [b.blob_hash for b in self.blobs.itervalues() if b.blob_hash in blobs_to_check and b.is_validated()]
|
blobs = [b.blob_hash for b in self.blobs.itervalues() if b.blob_hash in blobs_to_check and b.is_validated()]
|
||||||
return defer.succeed(blobs)
|
return defer.succeed(blobs)
|
||||||
|
|
||||||
|
def get_all_verified_blobs(self):
|
||||||
|
d = self.completed_blobs(self.blobs)
|
||||||
|
return d
|
||||||
|
|
||||||
def hashes_to_announce(self):
|
def hashes_to_announce(self):
|
||||||
now = time.time()
|
now = time.time()
|
||||||
blobs = [blob_hash for blob_hash, announce_time in self.blob_next_announces.iteritems() if announce_time < now]
|
blobs = [blob_hash for blob_hash, announce_time in self.blob_next_announces.iteritems() if announce_time < now]
|
||||||
|
|
|
@ -2454,12 +2454,17 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
d.addCallbacks(lambda _: self._render_response(True, OK_CODE), lambda err: self._render_response(err.getTraceback(), OK_CODE))
|
d.addCallbacks(lambda _: self._render_response(True, OK_CODE), lambda err: self._render_response(err.getTraceback(), OK_CODE))
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def jsonrpc_get_blobs(self):
|
def jsonrpc_get_blob_hashes(self):
|
||||||
"""
|
"""
|
||||||
return all blobs
|
Returns all blob hashes
|
||||||
|
|
||||||
|
Args:
|
||||||
|
None
|
||||||
|
Returns:
|
||||||
|
list of blob hashes
|
||||||
"""
|
"""
|
||||||
|
|
||||||
d = defer.succeed(self.session.blob_manager.blobs)
|
d = self.session.blob_manager.get_all_verified_blobs()
|
||||||
d.addCallback(lambda r: self._render_response(r, OK_CODE))
|
d.addCallback(lambda r: self._render_response(r, OK_CODE))
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue