bbc1.core.topology_manager module — BBc1 1.2 documentation

# bbc1.core.topology_manager module

Copyright (c) 2017 beyond-blockchain.org.

Licensed 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.

class `bbc1.core.topology_manager.` `TopologyManagerBase`(network=None, config=None, domain_id=None, node_id=None, loglevel='all', logname=None)

  Bases: `object`

  Network topology management for a domain

  This class defines how to create topology, meaning that who should be neighbors and provides very simple topology management, that is full mesh topology. If P2P routing algorithm is needed, you should override this class to upgrade functions. This class does not manage the neighbor list itself (It’s in BBcNetwork)

  `NEIGHBOR_LIST_REFRESH_INTERVAL` = 300
  `NOTIFY_NEIGHBOR_LIST` = b'\x00\x00'
  `make_neighbor_list`()

    make nodelist binary for advertising

  `notify_neighbor_update`(node_id, is_new=True)

    Update expiration timer for the notified node_id

    Parameters: | node_id (bytes) – target node_id is_new (bool) – If True, this node is a new comer node

  `process_message`(msg)

    Process received message

    Parameters: | msg (dict) – received message

  `stop_all_timers`()

    Invalidate all running timers

  `update_refresh_timer_entry`(new_entry=True, force_refresh_time=None)

    Update expiration timer