commit 0b4d4586b9c26168806cf597da79d18c3662e898 Author: juga0 juga@riseup.net Date: Fri Nov 23 07:51:36 2018 +0000
resultdump: store burst_bandwidth in results
In order to use it in torflow's scaling method. --- sbws/lib/resultdump.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/sbws/lib/resultdump.py b/sbws/lib/resultdump.py index 22e3f3a..149f6ff 100644 --- a/sbws/lib/resultdump.py +++ b/sbws/lib/resultdump.py @@ -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 @@ -227,6 +230,10 @@ class Result: 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