Tree object. More...
Public Member Functions | |
| def | __del__ |
| def | __init__ |
| def | __str__ |
| def | add_name_server |
| def | get_node |
| def | give_away_orb |
| def | has_path |
| def | is_component |
| def | is_directory |
| def | is_manager |
| def | is_nameserver |
| def | is_unknown |
| def | is_zombie |
| def | iterate |
| def | load_servers_from_env |
| def | orb |
| def | own_orb |
Private Member Functions | |
| def | _create_orb |
| def | _parse_name_server |
| def | _parse_name_servers |
Private Attributes | |
| _dynamic | |
| _orb | |
| _orb_is_mine | |
| _poa | |
| _root | |
Tree object.
Represents a tree of name servers, directories, managers and components. This stores the root node. All other nodes branch off from that. When creating a tree, you may pass no arguments, or a list of name servers to load, or a path or list of paths (as returned by rtctree.path.parse_path). If no arguments are given, the tree will load name servers from the environment variable specified in NAMESERVERS_ENV_VAR. If a list of servers are given, only those servers will be loaded. If paths are given, and the path is just '/', behaviour is as if no path argument were given. If a path starts with '/' and contains an element after it, that element will be treated as a name server. Otherwise the path is considered to be bad.
| def rtctree.tree.RTCTree.__init__ | ( | self, | |
servers = None, |
|||
paths = None, |
|||
orb = None, |
|||
filter = [], |
|||
dynamic = False, |
|||
| args, | |||
| kwargs | |||
| ) |
Constructor.
@param servers A list of servers to parse into the tree.
@param paths A list of paths from which to get servers to parse
into the tree.
@param orb If not None, the specified ORB will be used. If None,
the tree object will create its own ORB.
@param filter A list of paths (each a list of strings).
If not empty, then only objects in the paths will
be parsed, to increase speed. If the tail of a
path is a directory, that entire directory will be
parsed. Directories that are not the tail will
only have the next entry in the path parsed.
@param dynamic Use observers to keep the tree up-to-date. For example,
when a component changes state, an observer can notify
RTCTree so that the corresponding object in the tree can
be updated. Currently this only affects components.
@raises NonRootPathError
| def rtctree.tree.RTCTree.__del__ | ( | self | ) |
| def rtctree.tree.RTCTree.__str__ | ( | self | ) |
| def rtctree.tree.RTCTree._create_orb | ( | self, | |
orb = None |
|||
| ) | [private] |
| def rtctree.tree.RTCTree._parse_name_server | ( | self, | |
| address, | |||
filter = [], |
|||
dynamic = False |
|||
| ) | [private] |
| def rtctree.tree.RTCTree._parse_name_servers | ( | self, | |
| servers, | |||
filter = [], |
|||
dynamic = False |
|||
| ) | [private] |
| def rtctree.tree.RTCTree.add_name_server | ( | self, | |
| server, | |||
filter = [], |
|||
dynamic = None |
|||
| ) |
Parse a name server, adding its contents to the tree.
@param server The address of the name server, in standard
address format. e.g. 'localhost',
'localhost:2809', '59.7.0.1'.
@param filter Restrict the parsed objects to only those in this
path. For example, setting filter to [['/',
'localhost', 'host.cxt', 'comp1.rtc']] will
prevent 'comp2.rtc' in the same naming context
from being parsed.
@param dynamic Override the tree-wide dynamic setting. If not provided,
the value given when the tree was created will be used.
| def rtctree.tree.RTCTree.get_node | ( | self, | |
| path | |||
| ) |
| def rtctree.tree.RTCTree.give_away_orb | ( | self | ) |
| def rtctree.tree.RTCTree.has_path | ( | self, | |
| path | |||
| ) |
| def rtctree.tree.RTCTree.is_component | ( | self, | |
| path | |||
| ) |
| def rtctree.tree.RTCTree.is_directory | ( | self, | |
| path | |||
| ) |
| def rtctree.tree.RTCTree.is_manager | ( | self, | |
| path | |||
| ) |
| def rtctree.tree.RTCTree.is_nameserver | ( | self, | |
| path | |||
| ) |
| def rtctree.tree.RTCTree.is_unknown | ( | self, | |
| path | |||
| ) |
| def rtctree.tree.RTCTree.is_zombie | ( | self, | |
| path | |||
| ) |
| def rtctree.tree.RTCTree.iterate | ( | self, | |
| func, | |||
args = None, |
|||
filter = [] |
|||
| ) |
Call a function on the root node, and recursively all its children.
This is a depth-first iteration.
@param func The function to call. Its declaration must be
'def blag(node, args)', where 'node' is the current node
in the iteration and args is the value of @ref args.
@param args Extra arguments to pass to the function at each iteration.
Pass multiple arguments in as a tuple.
@param filter A list of filters to apply before calling func for each
node in the iteration. If the filter is not True,
@ref func will not be called for that node. Each filter
entry should be a string, representing on of the is_*
properties (is_component, etc), or a function object.
@return The results of the calls to @ref func in a list.
| def rtctree.tree.RTCTree.load_servers_from_env | ( | self, | |
filter = [], |
|||
dynamic = None |
|||
| ) |
Load the name servers environment variable and parse each server in
the list.
@param filter Restrict the parsed objects to only those in this
path. For example, setting filter to [['/',
'localhost', 'host.cxt', 'comp1.rtc']] will
prevent 'comp2.rtc' in the same naming context
from being parsed.
@param dynamic Override the tree-wide dynamic setting. If not provided,
the value given when the tree was created will be used.
| def rtctree.tree.RTCTree.orb | ( | self | ) |
| def rtctree.tree.RTCTree.own_orb | ( | self | ) |
rtctree::tree.RTCTree::_dynamic [private] |
rtctree::tree.RTCTree::_orb [private] |
rtctree::tree.RTCTree::_orb_is_mine [private] |
rtctree::tree.RTCTree::_poa [private] |
rtctree::tree.RTCTree::_root [private] |