def __init__(self,
                 block_manager,
                 transaction_committed,
                 get_committed_batch_by_id,
                 get_committed_batch_by_txn_id,
                 get_chain_head,
                 gossip,
                 cache_keep_time=1200,
                 cache_purge_frequency=30,
                 requested_keep_time=300):
        """
        :param block_manager (BlockManager) An object for getting and storing
            blocks safely
        :param transaction_committed (fn(transaction_id) -> bool) A function to
            determine if a transaction is committed.
        :param batch_committed (fn(batch_id) -> bool) A function to
            determine if a batch is committed.
        :param get_committed_batch_by_txn_id
            (fn(transaction_id) -> Batch) A function for retrieving a committed
            batch from a committed transction id.
        :param get_chain_head (fn() -> Block) A function for getting the
            current chain head.
        :param gossip (gossip.Gossip) Broadcasts block and batch request to
                peers
        :param cache_keep_time (float) Time in seconds to keep values in
            TimedCaches.
        :param cache_purge_frequency (float) Time between purging the
            TimedCaches.
        :param requested_keep_time (float) Time in seconds to keep the ids
            of requested objects. WARNING this time should always be less than
            cache_keep_time or the validator can get into a state where it
            fails to make progress because it thinks it has already requested
            something that it is missing.
        """
        self._gossip = gossip
        self._batch_cache = TimedCache(cache_keep_time, cache_purge_frequency)
        self._block_manager = block_manager

        self._transaction_committed = transaction_committed
        self._get_committed_batch_by_id = get_committed_batch_by_id
        self._get_committed_batch_by_txn_id = get_committed_batch_by_txn_id
        self._get_chain_head = get_chain_head

        self._seen_txns = TimedCache(cache_keep_time, cache_purge_frequency)
        self._incomplete_batches = TimedCache(cache_keep_time,
                                              cache_purge_frequency)
        self._incomplete_blocks = TimedCache(cache_keep_time,
                                             cache_purge_frequency)
        self._requested = TimedCache(requested_keep_time,
                                     cache_purge_frequency)
        self._on_block_received = None
        self._on_batch_received = None
        self.lock = RLock()

        # Tracks how many times an unsatisfied dependency is found
        self._unsatisfied_dependency_count = COLLECTOR.counter(
            'unsatisfied_dependency_count', instance=self)
        # Tracks the length of the completer's _seen_txns
        self._seen_txns_length = COLLECTOR.gauge(
            'seen_txns_length', instance=self)
        self._seen_txns_length.set_value(0)
        # Tracks the length of the completer's _incomplete_blocks
        self._incomplete_blocks_length = COLLECTOR.gauge(
            'incomplete_blocks_length', instance=self)
        self._incomplete_blocks_length.set_value(0)
        # Tracks the length of the completer's _incomplete_batches
        self._incomplete_batches_length = COLLECTOR.gauge(
            'incomplete_batches_length', instance=self)
        self._incomplete_batches_length.set_value(0)
def __init__ ( self , block_manager , transaction_committed , get_committed_batch_by_id , get_committed_batch_by_txn_id , get_chain_head , gossip , cache_keep_time = 1200 , cache_purge_frequency = 30 , requested_keep_time = 300 ) : self . _gossip = gossip self . _batch_cache = TimedCache ( cache_keep_time , cache_purge_frequency ) self . _block_manager = block_manager self . _transaction_committed = transaction_committed self . _get_committed_batch_by_id = get_committed_batch_by_id self . _get_committed_batch_by_txn_id = get_committed_batch_by_txn_id self . _get_chain_head = get_chain_head self . _seen_txns = TimedCache ( cache_keep_time , cache_purge_frequency ) self . _incomplete_batches = TimedCache ( cache_keep_time , cache_purge_frequency ) self . _incomplete_blocks = TimedCache ( cache_keep_time , cache_purge_frequency ) self . _requested = TimedCache ( requested_keep_time , cache_purge_frequency ) self . _on_block_received = None self . _on_batch_received = None self . lock = RLock ( ) self . _unsatisfied_dependency_count = COLLECTOR . counter ( 'unsatisfied_dependency_count' , instance = self ) self . _seen_txns_length = COLLECTOR . gauge ( 'seen_txns_length' , instance = self ) self . _seen_txns_length . set_value ( 0 ) self . _incomplete_blocks_length = COLLECTOR . gauge ( 'incomplete_blocks_length' , instance = self ) self . _incomplete_blocks_length . set_value ( 0 ) self . _incomplete_batches_length = COLLECTOR . gauge ( 'incomplete_batches_length' , instance = self ) self . _incomplete_batches_length . set_value ( 0 )
:param block_manager (BlockManager) An object for getting and storing
            blocks safely
        :param transaction_committed (fn(transaction_id) -> bool) A function to
            determine if a transaction is committed.
        :param batch_committed (fn(batch_id) -> bool) A function to
            determine if a batch is committed.
        :param get_committed_batch_by_txn_id
            (fn(transaction_id) -> Batch) A function for retrieving a committed
            batch from a committed transction id.
        :param get_chain_head (fn() -> Block) A function for getting the
            current chain head.
        :param gossip (gossip.Gossip) Broadcasts block and batch request to
                peers
        :param cache_keep_time (float) Time in seconds to keep values in
            TimedCaches.
        :param cache_purge_frequency (float) Time between purging the
            TimedCaches.
        :param requested_keep_time (float) Time in seconds to keep the ids
            of requested objects. WARNING this time should always be less than
            cache_keep_time or the validator can get into a state where it
            fails to make progress because it thinks it has already requested
            something that it is missing.