Pyro4.naming
— Pyro name server¶
Name Server and helper functions.
-
Pyro4.naming.
locateNS
(host=None, port=None, broadcast=True, hmac_key=None)¶ Get a proxy for a name server somewhere in the network.
-
Pyro4.naming.
resolve
(uri, hmac_key=None)¶ Resolve a ‘magic’ uri (PYRONAME) into the direct PYRO uri.
-
Pyro4.naming.
startNS
(host=None, port=None, enableBroadcast=True, bchost=None, bcport=None, unixsocket=None, nathost=None, natport=None, storage=None, hmac=None)¶ utility fuction to quickly get a Name server daemon to be used in your own event loops. Returns (nameserverUri, nameserverDaemon, broadcastServer).
-
Pyro4.naming.
startNSloop
(host=None, port=None, enableBroadcast=True, bchost=None, bcport=None, unixsocket=None, nathost=None, natport=None, storage=None, hmac=None)¶ utility function that starts a new Name server and enters its requestloop.
-
class
Pyro4.naming.
MemoryStorage
(**kwargs)¶ Storage implementation that is just an in-memory dict. (because it inherits from dict it is automatically a collections.MutableMapping) Stopping the nameserver will make the server instantly forget about everything.
-
class
Pyro4.naming.
NameServer
(storageProvider=None)¶ Pyro name server. Provides a simple flat name space to map logical object names to Pyro URIs. Default storage is done in an in-memory dictionary. You can provide custom storage types.
-
list
(prefix=None, regex=None)¶ Retrieve the registered items as a dictionary name-to-URI. The URIs in the resulting dict are strings, not URI objects. You can filter by prefix or by regex.
-
lookup
(name)¶ Lookup the given name, returns an URI if found
-
ping
()¶ A simple test method to check if the name server is running correctly.
-
register
(name, uri, safe=False)¶ Register a name with an URI. If safe is true, name cannot be registered twice. The uri can be a string or an URI object.
-
remove
(name=None, prefix=None, regex=None)¶ Remove a registration. returns the number of items removed.
-
Name Server persistent storage implementations.
-
class
Pyro4.naming_storage.
SqlStorage
(dbfile)¶ Sqlite-based storage, in just a single (name,uri) table. Sqlite db connection objects aren’t thread-safe, so a new connection is created in every method.
-
class
Pyro4.naming_storage.
DbmStorage
(dbmfile)¶ Storage implementation that uses a persistent dbm file. Because dbm only supports strings as key/value, we encode/decode them in utf-8. Dbm files cannot be accessed concurrently, so a strict concurrency model is used where only one operation is processed at the same time (this is very slow when compared to the in-memory storage)