예제 #1
0
 def initiate_meta_messages(self):
     """
     Setup all message that can be received by this community and the super classes.
     :return: list of meta messages.
     """
     return super(MultiChainCommunity, self).initiate_meta_messages() + [
         Message(
             self, SIGNATURE,
             DoubleMemberAuthentication(
                 allow_signature_func=self.allow_signature_request,
                 split_payload_func=split_function), PublicResolution(),
             DirectDistribution(), CandidateDestination(),
             SignaturePayload(), self._generic_timeline_check,
             self.received_signature_response),
         Message(self, CRAWL_REQUEST, MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), CrawlRequestPayload(),
                 self._generic_timeline_check, self.received_crawl_request),
         Message(self, CRAWL_RESPONSE, MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), CrawlResponsePayload(),
                 self._generic_timeline_check,
                 self.received_crawl_response),
         Message(self, CRAWL_RESUME, MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), CrawlResumePayload(),
                 self._generic_timeline_check,
                 self.received_crawl_resumption)
     ]
예제 #2
0
    def initiate_meta_messages(self):
        batch_delay = 1.0

        return [Message(self, u"channelcast", MemberAuthentication(encoding="sha1"), PublicResolution(), DirectDistribution(), CandidateDestination(), ChannelCastPayload(), self.check_channelcast, self.on_channelcast),
                Message(self, u"channelcast-request", MemberAuthentication(encoding="sha1"), PublicResolution(), DirectDistribution(), CandidateDestination(), ChannelCastRequestPayload(), self.check_channelcast_request, self.on_channelcast_request),
                Message(self, u"channelsearch", MemberAuthentication(encoding="sha1"), PublicResolution(), DirectDistribution(), CommunityDestination(node_count=10), ChannelSearchPayload(), self.check_channelsearch, self.on_channelsearch),
                Message(self, u"channelsearch-response", MemberAuthentication(encoding="sha1"), PublicResolution(), DirectDistribution(), CandidateDestination(), ChannelSearchResponsePayload(), self.check_channelsearch_response, self.on_channelsearch_response),
                Message(self, u"votecast", MemberAuthentication(encoding="sha1"), PublicResolution(), FullSyncDistribution(enable_sequence_number=False, synchronization_direction=u"DESC", priority=128), CommunityDestination(node_count=10), VoteCastPayload(), self.check_votecast, self.on_votecast, self.undo_votecast, batch=BatchConfiguration(max_window=batch_delay))
                ]
예제 #3
0
 def initiate_meta_messages(self):
     return super(BarterCommunity, self).initiate_meta_messages() + [
         Message(self, u"stats-request", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), StatisticsRequestPayload(),
                 self.check_stats_request, self.on_stats_request),
         Message(self, u"stats-response", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), StatisticsResponsePayload(),
                 self.check_stats_response, self.on_stats_response)
     ]
예제 #4
0
 def initiate_meta_messages(self):
     """
     Setup all message that can be received by this community and the super classes.
     :return: list of meta messages.
     """
     return super(TrustChainCommunity, self).initiate_meta_messages() + [
         Message(self, HALF_BLOCK, NoAuthentication(), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 HalfBlockPayload(), self._generic_timeline_check,
                 self.received_half_block),
         Message(self, HALF_BLOCK_BROADCAST, NoAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 NHopCommunityDestination(10, depth=2), HalfBlockPayload(),
                 self._generic_timeline_check, self.received_half_block),
         Message(self, BLOCK_PAIR, NoAuthentication(), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 BlockPairPayload(), self._generic_timeline_check,
                 self.received_block_pair),
         Message(self, BLOCK_PAIR_BROADCAST, NoAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 NHopCommunityDestination(10, depth=2), BlockPairPayload(),
                 self._generic_timeline_check, self.received_block_pair),
         Message(self, CRAWL, MemberAuthentication(), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 CrawlRequestPayload(), self._generic_timeline_check,
                 self.received_crawl_request)
     ]
예제 #5
0
 def initiate_meta_messages(self):
     pruning = GlobalTimePruning(10000, 11000)
     return [
         Message(self,
                 u"barter-record",
                 DoubleMemberAuthentication(
                     allow_signature_func=self.allow_signature_request,
                     encoding="bin"),
                 PublicResolution(),
                 LastSyncDistribution(synchronization_direction=u"DESC",
                                      priority=128,
                                      history_size=1,
                                      pruning=pruning),
                 CommunityDestination(node_count=10),
                 BarterRecordPayload(),
                 self.check_barter_record,
                 self.on_barter_record,
                 batch=BatchConfiguration(max_window=4.5)),
         Message(self, u"ping", NoAuthentication(), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 PingPayload(), self.check_ping, self.on_ping),
         Message(self, u"pong", NoAuthentication(), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 PongPayload(), self.check_pong, self.on_pong),
         Message(self, u"member-request", NoAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), MemberRequestPayload(),
                 self.check_member_request, self.on_member_request),
         Message(self, u"member-response",
                 MemberAuthentication(encoding="bin"), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 MemberResponsePayload(), self.check_member_response,
                 self.on_member_response),
     ]
예제 #6
0
 def initiate_meta_messages(self):
     return super(DemersTest, self).initiate_meta_messages() + [
         Message(
             self, u"text", MemberAuthentication(), PublicResolution(),
             FullSyncDistribution(enable_sequence_number=False,
                                  synchronization_direction=u"DESC",
                                  priority=128),
             CommunityDestination(node_count=10), TextPayload(),
             self.check_text, self.on_text)
     ]
예제 #7
0
 def initiate_meta_messages(self):
     return super(SearchCommunity, self).initiate_meta_messages() + [
         Message(self, u"search-request", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), SearchRequestPayload(),
                 self._generic_timeline_check, self.on_search),
         Message(self, u"search-response", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), SearchResponsePayload(),
                 self._generic_timeline_check, self.on_search_response),
         Message(self, u"torrent-request", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), TorrentRequestPayload(),
                 self._generic_timeline_check, self.on_torrent_request),
         Message(self, u"torrent-collect-request", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), TorrentCollectRequestPayload(),
                 self._generic_timeline_check,
                 self.on_torrent_collect_request),
         Message(self, u"torrent-collect-response", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), TorrentCollectResponsePayload(),
                 self._generic_timeline_check,
                 self.on_torrent_collect_response),
         Message(
             self, u"torrent", MemberAuthentication(), PublicResolution(),
             FullSyncDistribution(enable_sequence_number=False,
                                  synchronization_direction=u"ASC",
                                  priority=128),
             CommunityDestination(node_count=0), TorrentPayload(),
             self._generic_timeline_check, self.on_torrent),
     ]
예제 #8
0
 def initiate_meta_messages(self):
     return super(TemplateCommunity, self).initiate_meta_messages() + [
         Message(self,
                 u"text",
                 MemberAuthentication(),
                 LinearResolution(),
                 FullSyncDistribution(enable_sequence_number=False,
                                      synchronization_direction=u"ASC",
                                      priority=128),
                 CommunityDestination(node_count=10),
                 TextPayload(),
                 self.check_text,
                 self.on_text,
                 batch=BatchConfiguration(max_window=5.0))
     ]
예제 #9
0
 def initiate_meta_messages(self):
     return [Message(self, u"effort-record", DoubleMemberAuthentication(allow_signature_func=self.allow_signature_request, encoding="bin"), PublicResolution(), LastSyncDistribution(synchronization_direction=u"DESC", priority=128, history_size=1), CommunityDestination(node_count=10), EffortRecordPayload(), self.check_effort_record, self.on_effort_record, batch=BatchConfiguration(max_window=4.5)),
             Message(self, u"ping", NoAuthentication(), PublicResolution(), DirectDistribution(), CandidateDestination(), PingPayload(), self.check_ping, self.on_ping),
             Message(self, u"pong", NoAuthentication(), PublicResolution(), DirectDistribution(), CandidateDestination(), PongPayload(), self.check_pong, self.on_pong),
             Message(self, u"debug-request", MemberAuthentication(), LinearResolution(), DirectDistribution(), CommunityDestination(node_count=32), DebugRequestPayload(), self.check_debug_request, self.on_debug_request),
             Message(self, u"debug-response", MemberAuthentication(), PublicResolution(), DirectDistribution(), CandidateDestination(), DebugResponsePayload(), self.check_debug_response, self.on_debug_response)]