Unverified Commit e64e9a58 authored by Isis Lovecruft's avatar Isis Lovecruft
Browse files

Add docstring for bridgedb.Bridges.BridgeRing.insert().

parent 7249c7c0
...@@ -754,8 +754,19 @@ class BridgeRing(BridgeHolder): ...@@ -754,8 +754,19 @@ class BridgeRing(BridgeHolder):
subring.clear() subring.clear()
def insert(self, bridge): def insert(self, bridge):
"""Add a bridge to the ring. If the bridge is already there, """Add a **bridge** to this hashring.
replace the old one."""
The bridge's position in the hashring is dependent upon the HMAC of
the raw hash digest of the bridge's ID key. The function used to
generate the HMAC, :ivar:`BridgeRing.hmac`, is unique to each
individual hashring.
If the (presumably same) bridge is already at that determined position
in this hashring, replace the old one.
:type bridge: :class:`~bridgedb.Bridges.Bridge`
:param bridge: The bridge to insert into this hashring.
for tp,val,_,subring in self.subrings: for tp,val,_,subring in self.subrings:
if tp == 'port': if tp == 'port':
if val == bridge.orport: if val == bridge.orport:
Supports Markdown
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