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

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)[source]

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()[source]

make nodelist binary for advertising

notify_neighbor_update(node_id, is_new=True)[source]

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)[source]

Process received message

Parameters:msg (dict) – received message
stop_all_timers()[source]

Invalidate all running timers

update_refresh_timer_entry(new_entry=True, force_refresh_time=None)[source]

Update expiration timer