summaryrefslogtreecommitdiff
path: root/qpid/extras/dispatch/src/py/router/node.py
diff options
context:
space:
mode:
authorDarryl L. Pierce <mcpierce@apache.org>2013-08-23 19:34:57 +0000
committerDarryl L. Pierce <mcpierce@apache.org>2013-08-23 19:34:57 +0000
commitc3bf719a4bc722b7cdd4ddf9f6b1a3616f66a3d6 (patch)
treeb276094cc44850dfa10d2cbb5b9d048325700390 /qpid/extras/dispatch/src/py/router/node.py
parent0b9bebd801d411af77b6fbd892cc14d1338fb01a (diff)
downloadqpid-python-c3bf719a4bc722b7cdd4ddf9f6b1a3616f66a3d6.tar.gz
QPID-5066: Repackaged all Dispatch Python modules to qpid.dispatch
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1516995 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/extras/dispatch/src/py/router/node.py')
-rw-r--r--qpid/extras/dispatch/src/py/router/node.py103
1 files changed, 0 insertions, 103 deletions
diff --git a/qpid/extras/dispatch/src/py/router/node.py b/qpid/extras/dispatch/src/py/router/node.py
deleted file mode 100644
index 482a83dfe8..0000000000
--- a/qpid/extras/dispatch/src/py/router/node.py
+++ /dev/null
@@ -1,103 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-try:
- from dispatch import *
-except ImportError:
- from stubs import *
-
-
-class NodeTracker(object):
- """
- This module is responsible for tracking the set of router nodes that are known to this
- router. It tracks whether they are neighbor or remote and whether they are reachable.
- """
- def __init__(self, container):
- self.container = container
- self.id = self.container.id
- self.area = self.container.area
- self.nodes = {} # id => RemoteNode
-
-
- def tick(self, now):
- pass
-
-
- def new_neighbor(self, node_id):
- if node_id not in self.nodes:
- self.nodes[node_id] = RemoteNode(node_id)
- self.nodes[node_id].set_neighbor()
- self._notify(self.nodes[node_id])
-
-
- def lost_neighbor(self, node_id):
- node = self.nodes[node_id]
- node.clear_neighbor()
- self._notify(node)
- if node.to_delete():
- self.nodes.pop(node_id)
-
-
- def new_node(self, node_id):
- if node_id not in self.nodes:
- self.nodes[node_id] = RemoteNode(node_id)
- self.nodes[node_id].set_remote()
- self._notify(self.nodes[node_id])
-
-
- def lost_node(self, node_id):
- node = self.nodes[node_id]
- node.clear_remote()
- self._notify(node)
- if node.to_delete():
- self.nodes.pop(node_id)
-
-
- def _notify(self, node):
- if node.to_delete():
- self.container.adapter.node_updated("R%s" % node.id, 0, 0)
- else:
- is_neighbor = 0
- if node.neighbor:
- is_neighbor = 1
- self.container.adapter.node_updated("R%s" % node.id, 1, is_neighbor)
-
-
-class RemoteNode(object):
-
- def __init__(self, node_id):
- self.id = node_id
- self.neighbor = None
- self.remote = None
-
- def set_neighbor(self):
- self.neighbor = True
-
- def set_remote(self):
- self.remote = True
-
- def clear_neighbor(self):
- self.neighbor = None
-
- def clear_remote(self):
- self.remote = None
-
- def to_delete(self):
- return self.neighbor or self.remote
-