Package concurrent_tree_crawler :: Module rw_lock_tree_accessor :: Class RWLockTreeAccessor
[hide private]
[frames] | no frames]

Class RWLockTreeAccessor

source code


A version of the TreeAccessor where sensitive methods are protected by readers-writers lock.

Instance Methods [hide private]
 
__init__(self, sentinel) source code
 
get_lock(self) source code
(AbstractNode, NodeAction) pair or None
update_and_get_child(self, node, possible_children_names)
Append new children to the node and return a child that can be entered by the crawler.
source code
 
__update_with_potential_tree_change(self, node, possible_children_names) source code
 
set_node_type(self, node, is_leaf)
Set the leaf state of the node
source code
 
set_error(self, node)
Set the node state as NodeState.ERROR
source code

Inherited from tree_accessor.TreeAccessor: get_root, get_sentinel

Inherited from abstract_tree_accessor.AbstractTreeAccessor: get_path

Method Details [hide private]

__init__(self, sentinel)
(Constructor)

source code 
Parameters:
  • sentinel - a technical node which will be made parent of the root node.
Overrides: tree_accessor.TreeAccessor.__init__
(inherited documentation)

update_and_get_child(self, node, possible_children_names)

source code 

Append new children to the node and return a child that can be entered by the crawler.

Parameters:
  • node - node considered
  • possible_children_names - list of children names
Returns: (AbstractNode, NodeAction) pair or None
children node along with information what the crawler should do with it. None instead is returned if all children have state NodeState.CLOSED or NodeState.ERROR or the node has no children.
Overrides: abstract_tree_accessor.AbstractTreeAccessor.update_and_get_child
(inherited documentation)

set_node_type(self, node, is_leaf)

source code 

Set the leaf state of the node

Parameters:
  • is_leaf - True iff the node is a leaf
Overrides: abstract_tree_accessor.AbstractTreeAccessor.set_node_type
(inherited documentation)

set_error(self, node)

source code 

Set the node state as NodeState.ERROR

Overrides: abstract_tree_accessor.AbstractTreeAccessor.set_error
(inherited documentation)