Commit 0b4d4586 authored by juga  's avatar juga
Browse files

resultdump: store burst_bandwidth in results

In order to use it in torflow's scaling method.
parent 4b6aa955
......@@ -200,18 +200,21 @@ class Result:
''' Implements just enough of a stem RouterStatusEntryV3 for this
Result class to be happy '''
def __init__(self, fingerprint, nickname, address, master_key_ed25519,
average_bandwidth=None, observed_bandwidth=None):
average_bandwidth=None, burst_bandwidth=None,
observed_bandwidth=None):
self.fingerprint = fingerprint
self.nickname = nickname
self.address = address
self.master_key_ed25519 = master_key_ed25519
self.average_bandwidth = average_bandwidth
self.burst_bandwidth = burst_bandwidth
self.observed_bandwidth = observed_bandwidth
def __init__(self, relay, circ, dest_url, scanner_nick, t=None):
self._relay = Result.Relay(relay.fingerprint, relay.nickname,
relay.address, relay.master_key_ed25519,
relay.average_bandwidth,
relay.burst_bandwidth,
relay.observed_bandwidth)
self._circ = circ
self._dest_url = dest_url
......@@ -226,6 +229,10 @@ class Result:
def relay_average_bandwidth(self):
return self._relay.average_bandwidth
@property
def relay_burst_bandwidth(self):
return self._relay.burst_bandwidth
@property
def relay_observed_bandwidth(self):
return self._relay.observed_bandwidth
......@@ -480,7 +487,7 @@ class ResultSuccess(Result):
Result.Relay(
d['fingerprint'], d['nickname'], d['address'],
d['master_key_ed25519'], d['relay_average_bandwidth'],
d['relay_observed_bandwidth']),
d['relay_burst_bandwidth'], d['relay_observed_bandwidth']),
d['circ'], d['dest_url'], d['scanner'],
t=d['time'])
......@@ -490,6 +497,7 @@ class ResultSuccess(Result):
'rtts': self.rtts,
'downloads': self.downloads,
'relay_average_bandwidth': self.relay_average_bandwidth,
'relay_burst_bandwidth': self.relay_burst_bandwidth,
'relay_observed_bandwidth': self.relay_observed_bandwidth,
})
return d
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment