if not everyone_left:
return results
server = everyone_left.pop(0)
- server_name = server.longname()
+ server_name = server.get_longname()
connection = server.get_rref()
start = time.time()
d = connection.callRemote("get_buckets", "\x00"*16)
cancel_secret = self._get_cancel_secret(lease_seed)
d2 = rref.callRemote("add_lease", storageindex,
renew_secret, cancel_secret)
- d2.addErrback(self._add_lease_failed, s.name(), storageindex)
+ d2.addErrback(self._add_lease_failed, s.get_name(), storageindex)
d = rref.callRemote("get_buckets", storageindex)
def _wrap_results(res):
# internal methods
def loop(self):
- pending_s = ",".join([rt.server.name()
+ pending_s = ",".join([rt.server.get_name()
for rt in self.pending_requests]) # sort?
self.log(format="ShareFinder loop: running=%(running)s"
" hungry=%(hungry)s, pending=%(pending)s",
def send_request(self, server):
req = RequestToken(server)
self.pending_requests.add(req)
- lp = self.log(format="sending DYHB to [%(name)s]", name=server.name(),
+ lp = self.log(format="sending DYHB to [%(name)s]", name=server.get_name(),
level=log.NOISY, umid="Io7pyg")
time_sent = now()
d_ev = self._download_status.add_dyhb_request(server.get_serverid(),
d_ev.finished(shnums, time_received)
dyhb_rtt = time_received - time_sent
if not buckets:
- self.log(format="no shares from [%(name)s]", name=server.name(),
+ self.log(format="no shares from [%(name)s]", name=server.get_name(),
level=log.NOISY, parent=lp, umid="U7d4JA")
return
shnums_s = ",".join([str(shnum) for shnum in shnums])
self.log(format="got shnums [%(shnums)s] from [%(name)s]",
- shnums=shnums_s, name=server.name(),
+ shnums=shnums_s, name=server.get_name(),
level=log.NOISY, parent=lp, umid="0fcEZw")
shares = []
for shnum, bucket in buckets.iteritems():
def _got_error(self, f, server, req, d_ev, lp):
d_ev.error(now())
self.log(format="got error from [%(name)s]",
- name=server.name(), failure=f,
+ name=server.get_name(), failure=f,
level=log.UNUSUAL, parent=lp, umid="zUKdCw")
self.had_corruption = False # for unit tests
def __repr__(self):
- return "Share(sh%d-on-%s)" % (self._shnum, self._server.name())
+ return "Share(sh%d-on-%s)" % (self._shnum, self._server.get_name())
def is_alive(self):
# XXX: reconsider. If the share sees a single error, should it remain
log.msg(format="error requesting %(start)d+%(length)d"
" from %(server)s for si %(si)s",
start=start, length=length,
- server=self._server.name(), si=self._si_prefix,
+ server=self._server.get_name(), si=self._si_prefix,
failure=f, parent=lp, level=log.UNUSUAL, umid="BZgAJw")
# retire our observers, assuming we won't be able to make any
# further progress
# buckets is a dict: maps shum to an rref of the server who holds it
shnums_s = ",".join([str(shnum) for shnum in buckets])
self.log("got_response: [%s] has %d shares (%s)" %
- (server.name(), len(buckets), shnums_s),
+ (server.get_name(), len(buckets), shnums_s),
level=log.NOISY)
self._found_shares.update(buckets.keys())
for k in buckets:
def __repr__(self):
return ("<ServerTracker for server %s and SI %s>"
- % (self._server.name(), si_b2a(self.storage_index)[:5]))
+ % (self._server.get_name(), si_b2a(self.storage_index)[:5]))
def get_serverid(self):
return self._server.get_serverid()
- def name(self):
- return self._server.name()
+ def get_name(self):
+ return self._server.get_name()
def query(self, sharenums):
rref = self._server.get_rref()
self.num_servers_contacted += 1
self.query_count += 1
self.log("asking server %s for any existing shares" %
- (tracker.name(),), level=log.NOISY)
+ (tracker.get_name(),), level=log.NOISY)
dl = defer.DeferredList(ds)
dl.addCallback(lambda ign: self._loop())
return dl
serverid = tracker.get_serverid()
if isinstance(res, failure.Failure):
self.log("%s got error during existing shares check: %s"
- % (tracker.name(), res), level=log.UNUSUAL)
+ % (tracker.get_name(), res), level=log.UNUSUAL)
self.error_count += 1
self.bad_query_count += 1
else:
if buckets:
self.serverids_with_shares.add(serverid)
self.log("response to get_buckets() from server %s: alreadygot=%s"
- % (tracker.name(), tuple(sorted(buckets))),
+ % (tracker.get_name(), tuple(sorted(buckets))),
level=log.NOISY)
for bucket in buckets:
self.preexisting_shares.setdefault(bucket, set()).add(serverid)
if self._status:
self._status.set_status("Contacting Servers [%s] (first query),"
" %d shares left.."
- % (tracker.name(),
+ % (tracker.get_name(),
len(self.homeless_shares)))
d = tracker.query(shares_to_ask)
d.addBoth(self._got_response, tracker, shares_to_ask,
if self._status:
self._status.set_status("Contacting Servers [%s] (second query),"
" %d shares left.."
- % (tracker.name(),
+ % (tracker.get_name(),
len(self.homeless_shares)))
d = tracker.query(shares_to_ask)
d.addBoth(self._got_response, tracker, shares_to_ask,
else:
(alreadygot, allocated) = res
self.log("response to allocate_buckets() from server %s: alreadygot=%s, allocated=%s"
- % (tracker.name(),
+ % (tracker.get_name(),
tuple(sorted(alreadygot)), tuple(sorted(allocated))),
level=log.NOISY)
progress = False
self._trigger_cb = None
def __repr__(self):
- return "<NativeStorageServer for %s>" % self.name()
+ return "<NativeStorageServer for %s>" % self.get_name()
def get_serverid(self):
return self._tubid
def get_permutation_seed(self):
if self.rref:
return self.rref.version
return None
- def name(self): # keep methodname short
+ def get_name(self): # keep methodname short
return self.serverid_s
- def longname(self):
+ def get_longname(self):
return idlib.nodeid_b2a(self._tubid)
def get_lease_seed(self):
return self._tubid
def _got_connection(self, rref):
lp = log.msg(format="got connection to %(name)s, getting versions",
- name=self.name(),
+ name=self.get_name(),
facility="tahoe.storage_broker", umid="coUECQ")
if self._trigger_cb:
eventually(self._trigger_cb)
d = add_version_to_remote_reference(rref, default)
d.addCallback(self._got_versioned_service, lp)
d.addErrback(log.err, format="storageclient._got_connection",
- name=self.name(), umid="Sdq3pg")
+ name=self.get_name(), umid="Sdq3pg")
def _got_versioned_service(self, rref, lp):
log.msg(format="%(name)s provided version info %(version)s",
- name=self.name(), version=rref.version,
+ name=self.get_name(), version=rref.version,
facility="tahoe.storage_broker", umid="SWmJYg",
level=log.NOISY, parent=lp)
return self.rref
def _lost(self):
- log.msg(format="lost connection to %(name)s", name=self.name(),
+ log.msg(format="lost connection to %(name)s", name=self.get_name(),
facility="tahoe.storage_broker", umid="zbRllw")
self.last_loss_time = time.time()
self.rref = None
self.serverid = serverid
self.rref = rref
def __repr__(self):
- return "<NoNetworkServer for %s>" % self.name()
+ return "<NoNetworkServer for %s>" % self.get_name()
def get_serverid(self):
return self.serverid
def get_permutation_seed(self):
return self.serverid
def get_lease_seed(self):
return self.serverid
- def name(self):
+ def get_name(self):
return idlib.shortnodeid_b2a(self.serverid)
- def longname(self):
+ def get_longname(self):
return idlib.nodeid_b2a(self.serverid)
def get_nickname(self):
return "nickname"
self._server = server
self._dyhb_rtt = rtt
def __repr__(self):
- return "sh%d-on-%s" % (self._shnum, self._server.name())
+ return "sh%d-on-%s" % (self._shnum, self._server.get_name())
class MySegmentFetcher(SegmentFetcher):
def __init__(self, *args, **kwargs):
def _check2(ign):
self.failUnless(node.failed)
self.failUnless(node.failed.check(NotEnoughSharesError))
- sname = serverA.name()
+ sname = serverA.get_name()
self.failUnlessIn("complete= pending=sh0-on-%s overdue= unused=" % sname,
str(node.failed))
d.addCallback(_check2)
def _check4(ign):
self.failUnless(node.failed)
self.failUnless(node.failed.check(NotEnoughSharesError))
- sname = servers["peer-2"].name()
+ sname = servers["peer-2"].get_name()
self.failUnlessIn("complete=sh0 pending= overdue=sh2-on-%s unused=" % sname,
str(node.failed))
d.addCallback(_check4)
return self.serverid
def get_rref(self):
return self.rref
- def name(self):
+ def get_name(self):
return "name-%s" % self.serverid
def get_version(self):
return self.rref.version
shareids.reverse()
shareids_s = [ T.tt[shareid, " "] for shareid in sorted(shareids) ]
servermap.append(T.tr[T.td[T.div(class_="nickname")[nickname],
- T.div(class_="nodeid")[T.tt[s.name()]]],
+ T.div(class_="nodeid")[T.tt[s.get_name()]]],
T.td[shareids_s],
])
num_shares_left -= len(shareids)
def render_service_row(self, ctx, server):
nodeid = server.get_serverid()
- ctx.fillSlots("peerid", server.longname())
+ ctx.fillSlots("peerid", server.get_longname())
ctx.fillSlots("nickname", server.get_nickname())
rhost = server.get_remote_host()
if rhost: