BridgeData
(hex_key, address, or_port, distributor='unallocated', first_seen='', last_seen='')[source]¶Bases: object
Value class carrying bridge information: hex_key - The unique hex key of the given bridge address - Bridge IP address or_port - Bridge TCP port distributor - The distributor (or pseudo-distributor) through which
this bridge is being announced
first_seen - When did we first see this bridge online? last_seen - When was the last time we saw this bridge online?
Database
(sqlite_fname)[source]¶Bases: object
insertBridgeAndGetRing
(bridge, setRing, seenAt, validRings, defaultPool='unallocated')[source]¶Updates info about bridge, setting ring to setRing if none was set. Also sets distributor to `defaultPool’ if the bridge was found in the database, but its distributor isn’t valid anymore.
Returns the name of the distributor the bridge is assigned to.
DBGeneratorContextManager
(gen)[source]¶Bases: contextlib.GeneratorContextManager
Helper for @contextmanager decorator.
Overload __exit__() so we can call the generator many times
contextmanager
(func)[source]¶Decorator to for Storage.getDB()
Define getDB() for use by with statement content manager
getDB
(*args, **kwds)[source]¶Generator: Return a usable database handler
Always return a bridgedb.Storage.Database
that is
usable within the current thread. If a connection already exists
and it was created by the current thread, then return the
associated bridgedb.Storage.Database
instance. Otherwise,
create a new instance, blocking until the existing connection
is closed, if applicable.
Return type: | bridgedb.Storage.Database |
---|---|
Returns: | An instance of bridgedb.Storage.Database used to
query the database |