Merge pull request #139 from lbryio/get_all_verified_blobs
Get all verified blobs
This commit is contained in:
commit
76b297b173
2 changed files with 21 additions and 4 deletions
|
@ -67,6 +67,9 @@ class BlobManager(DHTHashSupplier):
|
|||
def blob_paid_for(self, blob_hash, amount):
|
||||
pass
|
||||
|
||||
def get_all_verified_blobs(self):
|
||||
pass
|
||||
|
||||
|
||||
class DiskBlobManager(BlobManager):
|
||||
"""This class stores blobs on the hard disk"""
|
||||
|
@ -78,7 +81,7 @@ class DiskBlobManager(BlobManager):
|
|||
self.blob_type = BlobFile
|
||||
self.blob_creator_type = BlobFileCreator
|
||||
self.blobs = {}
|
||||
self.blob_hashes_to_delete = {} # {blob_hash: being_deleted (True/False)}
|
||||
self.blob_hashes_to_delete = {} # {blob_hash: being_deleted (True/False)}
|
||||
self._next_manage_call = None
|
||||
|
||||
def setup(self):
|
||||
|
@ -177,6 +180,11 @@ class DiskBlobManager(BlobManager):
|
|||
def check_consistency(self):
|
||||
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):
|
||||
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()]
|
||||
return defer.succeed(blobs)
|
||||
|
||||
def get_all_verified_blobs(self):
|
||||
d = self.completed_blobs(self.blobs)
|
||||
return d
|
||||
|
||||
def hashes_to_announce(self):
|
||||
now = time.time()
|
||||
blobs = [blob_hash for blob_hash, announce_time in self.blob_next_announces.iteritems() if announce_time < now]
|
||||
|
|
|
@ -2455,12 +2455,17 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
|||
d.addCallbacks(lambda _: self._render_response(True, OK_CODE), lambda err: self._render_response(err.getTraceback(), OK_CODE))
|
||||
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))
|
||||
return d
|
||||
|
||||
|
|
Loading…
Reference in a new issue