pyrolab.configure.NameServerConfiguration

pyrolab.configure.NameServerConfiguration#

class NameServerConfiguration(_env_file: DotenvType | None = '<object object>', _env_file_encoding: str | None = None, _env_nested_delimiter: str | None = None, _secrets_dir: StrPath | None = None, *, host: str = 'localhost', ns_port: int = 9090, broadcast: bool = False, ns_bchost: bool | None = None, ns_bcport: int = 9091, ns_autoclean: float = 0.0, storage: str = 'memory')[source]#

Bases: BaseSettings, PyroConfigMixin, YAMLMixin

The NameServer Settings class.

Contains all applicable configuration parameters for running a nameserver.

Parameters:
hoststr, optional

The hostname of the nameserver. Defaults to “localhost” for security. Can be set to “public”, which is dynamically translated to the machine’s ip address when the nameserver is started.

ns_portint, optional

The port of the nameserver. Defaults to 9090.

broadcastbool, optional

Whether to launch a broadcast server. Defaults to False.

ns_bchoststr, optional

The hostname of the broadcast server. Defaults to None.

ns_bcportint, optional

The port of the broadcast server. Defaults to 9091.

ns_autocleanfloat, optional

The interval in seconds at which the nameserver will ping registered objects and clean up unresponsive ones. Default is 0.0 (off).

storagestr, optional

A Pyro5-style storage string. You have several options:

  • memory: Fast, volatile in-memory database. This is the default.

  • dbm[:dbfile]: Persistent database using dbm. Optionally provide the filename to use (ignore for PyroLab to create automatically). This storage type does not support metadata.

  • sql[:dbfile]: Persistent database using sqlite. Optionally provide the filename to use (ignore for PyroLab to create automatically).

Examples

The following are examples of valid YAML configurations for nameservers. Keys not defined assume the default values.

Example 1. Basic configuration.

host: localhost
ns_port: 9090
ns_autoclean: 0.0
storage: memory

Example 2. Nameserver publicly accessible.

host: public
ns_port: 9100
broadcast: false
ns_bchost: null
ns_bcport: 9091
ns_autoclean: 15.0
storage: sql
Attributes:
name

Methods

construct([_fields_set])

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.

copy(*[, include, exclude, update, deep])

Duplicate a model, optionally choose which fields to include, exclude and change.

dict(*[, include, exclude, by_alias, ...])

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

from_file(filename)

Loads a configuration from a YAML file.

from_yaml(yaml)

Loads a YAML representation of the configuration.

get_storage_location()

Returns the storage location for the given name.

json(*[, include, exclude, by_alias, ...])

Generate a JSON representation of the model, include and exclude arguments as per dict().

update_forward_refs(**localns)

Try to update ForwardRefs on fields based on this Model, globalns and localns.

update_pyro_config()

Sets all key-value attributes that are Pyro5 configuration options.

yaml([sort_keys, default_flow_style, ...])

Returns a YAML representation of the configuration.

Config

from_orm

parse_file

parse_obj

parse_raw

schema

schema_json

set_name

valid_memory_format

validate