change attribute "uri" to "name"
This commit is contained in:
parent
59a5a3164f
commit
9744287370
6 changed files with 27 additions and 27 deletions
|
@ -464,7 +464,7 @@ class DownloadRequest(RequestHelper):
|
|||
blob_details.cancel_func,
|
||||
blob
|
||||
)
|
||||
log.info("Requesting blob %s from %s", blob.blob_hash, self.peer)
|
||||
log.debug("Requesting blob %s from %s", blob.blob_hash, self.peer)
|
||||
return request
|
||||
|
||||
def _handle_download_request(self, client_blob_request):
|
||||
|
|
|
@ -146,7 +146,7 @@ class FullStreamProgressManager(StreamProgressManager):
|
|||
current_blob_num = self.last_blob_outputted + 1
|
||||
|
||||
if current_blob_num in blobs and blobs[current_blob_num].is_validated():
|
||||
log.info("Outputting blob %s", str(self.last_blob_outputted + 1))
|
||||
log.debug("Outputting blob %s", str(self.last_blob_outputted + 1))
|
||||
self.provided_blob_nums.append(self.last_blob_outputted + 1)
|
||||
d = self.download_manager.handle_blob(self.last_blob_outputted + 1)
|
||||
d.addCallback(lambda _: finished_outputting_blob())
|
||||
|
|
|
@ -19,7 +19,7 @@ from lbrynet.lbryfile.StreamDescriptor import save_sd_info
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def log_status(uri, sd_hash, status):
|
||||
def log_status(name, sd_hash, status):
|
||||
if status == ManagedEncryptedFileDownloader.STATUS_RUNNING:
|
||||
status_string = "running"
|
||||
elif status == ManagedEncryptedFileDownloader.STATUS_STOPPED:
|
||||
|
@ -28,7 +28,7 @@ def log_status(uri, sd_hash, status):
|
|||
status_string = "finished"
|
||||
else:
|
||||
status_string = "unknown"
|
||||
log.info("lbry://%s (%s) is %s", uri, short_hash(sd_hash), status_string)
|
||||
log.info("lbry://%s (%s) is %s", name, short_hash(sd_hash), status_string)
|
||||
|
||||
|
||||
class ManagedEncryptedFileDownloader(EncryptedFileSaver):
|
||||
|
@ -49,7 +49,7 @@ class ManagedEncryptedFileDownloader(EncryptedFileSaver):
|
|||
self.sd_hash = None
|
||||
self.txid = None
|
||||
self.nout = None
|
||||
self.uri = None
|
||||
self.name = None
|
||||
self.claim_id = None
|
||||
self.rowid = rowid
|
||||
self.lbry_file_manager = lbry_file_manager
|
||||
|
@ -64,7 +64,7 @@ class ManagedEncryptedFileDownloader(EncryptedFileSaver):
|
|||
yield self.load_file_attributes()
|
||||
|
||||
status = yield self.lbry_file_manager.get_lbry_file_status(self)
|
||||
log_status(self.uri, self.sd_hash, status)
|
||||
log_status(self.name, self.sd_hash, status)
|
||||
|
||||
if status == ManagedEncryptedFileDownloader.STATUS_RUNNING:
|
||||
# start returns self.finished_deferred
|
||||
|
@ -115,12 +115,12 @@ class ManagedEncryptedFileDownloader(EncryptedFileSaver):
|
|||
stream_metadata = yield self.wallet.get_claim_metadata_for_sd_hash(self.sd_hash)
|
||||
if stream_metadata:
|
||||
name, txid, nout = stream_metadata
|
||||
self.uri = name
|
||||
self.name = name
|
||||
self.txid = txid
|
||||
self.nout = nout
|
||||
else:
|
||||
raise NoSuchSDHash(self.sd_hash)
|
||||
self.claim_id = yield self.wallet.get_claimid(self.uri, self.txid, self.nout)
|
||||
self.claim_id = yield self.wallet.get_claimid(self.name, self.txid, self.nout)
|
||||
defer.returnValue(None)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
|
@ -128,7 +128,7 @@ class ManagedEncryptedFileDownloader(EncryptedFileSaver):
|
|||
yield EncryptedFileSaver._start(self)
|
||||
yield self.load_file_attributes()
|
||||
status = yield self._save_status()
|
||||
log_status(self.uri, self.sd_hash, status)
|
||||
log_status(self.name, self.sd_hash, status)
|
||||
defer.returnValue(status)
|
||||
|
||||
def _get_finished_deferred_callback_value(self):
|
||||
|
|
|
@ -39,8 +39,8 @@ class EncryptedFileReflectorClient(Protocol):
|
|||
lambda err: log.warning("An error occurred immediately: %s", err.getTraceback()))
|
||||
|
||||
@property
|
||||
def lbry_uri(self):
|
||||
return "lbry://%s" % self.factory.lbry_uri
|
||||
def name(self):
|
||||
return "lbry://%s" % self.factory.name
|
||||
|
||||
@property
|
||||
def blob_manager(self):
|
||||
|
@ -74,20 +74,20 @@ class EncryptedFileReflectorClient(Protocol):
|
|||
if reason.check(error.ConnectionDone):
|
||||
if not self.needed_blobs:
|
||||
log.info("Reflector has all blobs for %s (%s)",
|
||||
self.lbry_uri, self.stream_descriptor)
|
||||
self.name, self.stream_descriptor)
|
||||
elif not self.reflected_blobs:
|
||||
log.info("No more completed blobs for %s (%s) to reflect, %i are still needed",
|
||||
self.lbry_uri, self.stream_descriptor, len(self.needed_blobs))
|
||||
self.name, self.stream_descriptor, len(self.needed_blobs))
|
||||
else:
|
||||
log.info('Finished sending reflector %i blobs for %s (%s)',
|
||||
len(self.reflected_blobs), self.lbry_uri, self.stream_descriptor)
|
||||
len(self.reflected_blobs), self.name, self.stream_descriptor)
|
||||
self.factory.finished_deferred.callback(self.reflected_blobs)
|
||||
elif reason.check(error.ConnectionLost):
|
||||
log.warning("Stopped reflecting %s (%s) after sending %i blobs", self.lbry_uri,
|
||||
log.warning("Stopped reflecting %s (%s) after sending %i blobs", self.name,
|
||||
self.stream_descriptor, len(self.reflected_blobs))
|
||||
self.factory.finished_deferred.callback(self.reflected_blobs)
|
||||
else:
|
||||
log.info('Reflector finished for %s (%s): %s', self.lbry_uri, self.stream_descriptor,
|
||||
log.info('Reflector finished for %s (%s): %s', self.name, self.stream_descriptor,
|
||||
reason)
|
||||
self.factory.finished_deferred.callback(reason)
|
||||
|
||||
|
@ -131,7 +131,7 @@ class EncryptedFileReflectorClient(Protocol):
|
|||
log.info("Reflector needs %s%i blobs for %s",
|
||||
needs_desc,
|
||||
len(filtered),
|
||||
self.lbry_uri)
|
||||
self.name)
|
||||
return filtered
|
||||
|
||||
d = self.factory.stream_info_manager.get_blobs_for_stream(self.factory.stream_hash)
|
||||
|
@ -223,7 +223,7 @@ class EncryptedFileReflectorClient(Protocol):
|
|||
log.info("Sent reflector descriptor %s", self.next_blob_to_send)
|
||||
else:
|
||||
log.warning("Reflector failed to receive descriptor %s for %s",
|
||||
self.next_blob_to_send, self.lbry_uri)
|
||||
self.next_blob_to_send, self.name)
|
||||
self.blob_hashes_to_send.append(self.next_blob_to_send.blob_hash)
|
||||
return self.set_not_uploading()
|
||||
|
||||
|
@ -236,7 +236,7 @@ class EncryptedFileReflectorClient(Protocol):
|
|||
return defer.succeed(True)
|
||||
else:
|
||||
log.warning("Reflector already has %s for %s", self.next_blob_to_send,
|
||||
self.lbry_uri)
|
||||
self.name)
|
||||
return self.set_not_uploading()
|
||||
else: # Expecting Server Blob Response
|
||||
if 'received_blob' not in response_dict:
|
||||
|
@ -245,10 +245,10 @@ class EncryptedFileReflectorClient(Protocol):
|
|||
if response_dict['received_blob']:
|
||||
self.reflected_blobs.append(self.next_blob_to_send.blob_hash)
|
||||
log.debug("Sent reflector blob %s for %s", self.next_blob_to_send,
|
||||
self.lbry_uri)
|
||||
self.name)
|
||||
else:
|
||||
log.warning("Reflector failed to receive blob %s for %s",
|
||||
self.next_blob_to_send, self.lbry_uri)
|
||||
self.next_blob_to_send, self.name)
|
||||
self.blob_hashes_to_send.append(self.next_blob_to_send.blob_hash)
|
||||
return self.set_not_uploading()
|
||||
|
||||
|
@ -284,12 +284,12 @@ class EncryptedFileReflectorClient(Protocol):
|
|||
err.trap(ValueError)
|
||||
if blob_hash not in self.failed_blob_hashes:
|
||||
log.warning("Failed to reflect blob %s for %s, reason: %s",
|
||||
str(blob_hash)[:16], self.lbry_uri, err.getTraceback())
|
||||
str(blob_hash)[:16], self.name, err.getTraceback())
|
||||
self.blob_hashes_to_send.append(blob_hash)
|
||||
self.failed_blob_hashes.append(blob_hash)
|
||||
else:
|
||||
log.warning("Failed second try reflecting blob %s for %s, giving up, reason: %s",
|
||||
str(blob_hash)[:16], self.lbry_uri, err.getTraceback())
|
||||
str(blob_hash)[:16], self.name, err.getTraceback())
|
||||
|
||||
def send_next_request(self):
|
||||
if self.file_sender is not None:
|
||||
|
@ -335,8 +335,8 @@ class EncryptedFileReflectorClientFactory(ClientFactory):
|
|||
return self._lbry_file.stream_hash
|
||||
|
||||
@property
|
||||
def lbry_uri(self):
|
||||
return self._lbry_file.uri
|
||||
def name(self):
|
||||
return self._lbry_file.name
|
||||
|
||||
@property
|
||||
def protocol_version(self):
|
||||
|
|
|
@ -61,7 +61,7 @@ DummyBlobAvailabilityTracker = mocks.BlobAvailabilityTracker
|
|||
|
||||
|
||||
log_format = "%(funcName)s(): %(message)s"
|
||||
logging.basicConfig(level=logging.WARNING, format=log_format)
|
||||
logging.basicConfig(level=logging.CRITICAL, format=log_format)
|
||||
|
||||
|
||||
def require_system(system):
|
||||
|
|
|
@ -16,7 +16,7 @@ class FakeLBRYFile(object):
|
|||
self.blob_manager = blob_manager
|
||||
self.stream_info_manager = stream_info_manager
|
||||
self.stream_hash = stream_hash
|
||||
self.uri = "fake_uri"
|
||||
self.name = "fake_uri"
|
||||
|
||||
|
||||
class Node(object):
|
||||
|
|
Loading…
Reference in a new issue