예제 #1
0
    def __init__(self):
        CommonThread.__init__(self)
        self.__timer_list: Dict[str, Timer] = {}
        self.__loop: asyncio.BaseEventLoop = asyncio.new_event_loop()
        # self.__loop.set_debug(True)

        self._futures: Dict[str, Future] = {}
예제 #2
0
 def start(self, port, peer_id="", group_id=""):
     self.__port = port
     if self.__inner_service_port is None:
         self.__inner_service_port = int(port) + conf.PORT_DIFF_INNER_SERVICE
     self.__peer_id = peer_id
     self.__group_id = group_id
     CommonThread.start(self)
예제 #3
0
    def __init__(self,
                 channel_service: 'ChannelService',
                 channel: str = None,
                 **kwargs):
        CommonThread.__init__(self)
        Publisher.__init__(self, [
            Consensus.EVENT_COMPLETE_CONSENSUS,
            Consensus.EVENT_LEADER_COMPLAIN_F_1,
            Consensus.EVENT_LEADER_COMPLAIN_2F_1, Consensus.EVENT_MAKE_BLOCK
        ])

        self.channel_name = channel
        self.__channel_service = channel_service
        self.__peer_manager = channel_service.peer_manager
        self.__last_epoch: Epoch = None
        self.__precommit_block: Block = None
        self.__epoch: Epoch = None
        self.__leader_id = None
        self.__tx_queue = AgingCache(
            max_age_seconds=conf.MAX_TX_QUEUE_AGING_SECONDS,
            default_item_status=TransactionStatusInQueue.normal)
        self.__sleep_time = None
        self.__run_logic = None
        self.__block_generation_scheduler = BlockGenerationScheduler(
            self.channel_name)

        self.__init_data()
예제 #4
0
 def start(self, port, peer_id="", group_id=""):
     self.__port = port
     self.peer_id = peer_id
     self.__group_id = group_id
     CommonThread.start(self)
     self.__broadcast_process.set_to_process(
         BroadcastProcess.PROCESS_INFO_KEY,
         f"peer_id({self.get_peer_id()})")
예제 #5
0
 def __init__(self, peer_port, peer_ip_address=None):
     if peer_ip_address is None:
         peer_ip_address = conf.IP_LOCAL
     CommonThread.__init__(self)
     self.__peer_port = peer_port
     self.__peer_ip_address = peer_ip_address
     ServerComponents().set_argument()
     ServerComponents().set_resource()
예제 #6
0
 def start(self, port, peer_id="", group_id=""):
     self.__port = port
     if self.__inner_service_port is None:
         self.__inner_service_port = port + conf.PORT_DIFF_INNER_SERVICE
     self.__peer_id = peer_id
     self.__group_id = group_id
     CommonThread.start(self)
     self.__broadcast_process.set_to_process(BroadcastProcess.PROCESS_INFO_KEY, f"peer_id({self.__peer_id})")
예제 #7
0
 def __init__(self):
     CommonThread.__init__(self)
     self.__timer_list = {}
예제 #8
0
 def __init__(self):
     CommonThread.__init__(self)
     self.__timer_list = {}
     self.__loop: asyncio.BaseEventLoop = asyncio.new_event_loop()
예제 #9
0
 def __init__(self, peer_port):
     CommonThread.__init__(self)
     self.__peer_port = peer_port
     ServerComponents().set_argument()
     ServerComponents().set_resource()
예제 #10
0
 def __init__(self, channel):
     CommonThread.__init__(self)
     self.__channel_name = channel
     self.__schedule_queue = queue.Queue()
예제 #11
0
 def __init__(self):
     CommonThread.__init__(self)
     self.__job = queue.Queue()
     self.__process = None
예제 #12
0
 def stop(self):
     if conf.ALLOW_MAKE_EMPTY_BLOCK:
         self.__block_generation_scheduler.stop()
     CommonThread.stop(self)