def start(self): from access import key_ring from transport import callback key_ring.init() callback.add_outbox_callback(self._outbox_packet_sent) callback.append_inbox_callback(self._inbox_packet_received) return True
def start(self): from storage import backup_fs from storage import backup_control from storage import backup_matrix from storage import backup_monitor from main.config import conf from main import control from main import events from main import listeners from transport import callback from p2p import p2p_connector backup_fs.init() backup_control.init() backup_matrix.init() backup_matrix.SetBackupStatusNotifyCallback(control.on_backup_stats) backup_matrix.SetLocalFilesNotifyCallback(control.on_read_local_files) backup_monitor.A('init') backup_monitor.A('restart') conf().addConfigNotifier('services/backups/keep-local-copies-enabled', self._on_keep_local_copies_modified) conf().addConfigNotifier('services/backups/wait-suppliers-enabled', self._on_wait_suppliers_modified) p2p_connector.A().addStateChangedCallback( self._on_p2p_connector_state_changed, 'INCOMMING?', 'CONNECTED') p2p_connector.A().addStateChangedCallback( self._on_p2p_connector_state_changed, 'MY_IDENTITY', 'CONNECTED') callback.append_inbox_callback(self._on_inbox_packet_received) events.add_subscriber(self._on_my_identity_rotated, 'my-identity-rotated') events.add_subscriber(self._on_key_erased, 'key-erased') if listeners.is_populate_requered('remote_version'): listeners.populate_later().remove('remote_version') backup_matrix.populate_remote_versions() return True
def start(self): from logs import lg from main import events from contacts import contactsdb from supplier import family_member from transport import callback # TODO: check all imports.! my_id must be loaded latest as possible! from userid import my_id callback.append_inbox_callback(self._on_inbox_packet_received) for customer_idurl in contactsdb.customers(): if not customer_idurl: continue if customer_idurl == my_id.getLocalIDURL(): lg.warn('skipping my own identity') continue fm = family_member.by_customer_idurl(customer_idurl) if not fm: fm = family_member.create_family(customer_idurl) fm.automat('init') local_customer_meta_info = contactsdb.get_customer_meta_info(customer_idurl) fm.automat('family-join', { 'supplier_idurl': my_id.getLocalIDURL(), 'ecc_map': local_customer_meta_info.get('ecc_map'), 'position': local_customer_meta_info.get('position', -1), 'family_snapshot': local_customer_meta_info.get('family_snapshot'), }) events.add_subscriber(self._on_existing_customer_accepted, 'existing-customer-accepted') events.add_subscriber(self._on_new_customer_accepted, 'new-customer-accepted') events.add_subscriber(self._on_existing_customer_terminated, 'existing-customer-terminated') return True
def start(self): from storage import backup_fs from storage import backup_control from storage import backup_matrix from storage import backup_monitor from main.config import conf from main import control from transport import callback from p2p import p2p_connector backup_fs.init() backup_control.init() backup_matrix.init() backup_matrix.SetBackupStatusNotifyCallback(control.on_backup_stats) backup_matrix.SetLocalFilesNotifyCallback(control.on_read_local_files) backup_monitor.A('init') backup_monitor.A('restart') conf().addCallback('services/backups/keep-local-copies-enabled', self._on_keep_local_copies_modified) conf().addCallback('services/backups/wait-suppliers-enabled', self._on_wait_suppliers_modified) p2p_connector.A().addStateChangedCallback( self._on_p2p_connector_state_changed, 'INCOMMING?', 'CONNECTED') p2p_connector.A().addStateChangedCallback( self._on_p2p_connector_state_changed, 'MY_IDENTITY', 'CONNECTED') callback.append_inbox_callback(self._on_inbox_packet_received) return True
def start(self): from logs import lg from transport import callback from main import events from contacts import contactsdb from storage import accounting from services import driver from supplier import customer_space callback.append_inbox_callback(self._on_inbox_packet_received) events.add_subscriber(customer_space.on_identity_url_changed, 'identity-url-changed') events.add_subscriber(customer_space.on_customer_accepted, 'existing-customer-accepted') events.add_subscriber(customer_space.on_customer_accepted, 'new-customer-accepted') events.add_subscriber(customer_space.on_customer_terminated, 'existing-customer-denied') events.add_subscriber(customer_space.on_customer_terminated, 'existing-customer-terminated') space_dict, _ = accounting.read_customers_quotas() for customer_idurl in contactsdb.customers(): known_customer_meta_info = contactsdb.get_customer_meta_info(customer_idurl) events.send('existing-customer-accepted', data=dict( idurl=customer_idurl, allocated_bytes=space_dict.get(customer_idurl.to_bin()), ecc_map=known_customer_meta_info.get('ecc_map'), position=known_customer_meta_info.get('position'), )) if driver.is_on('service_entangled_dht'): self._do_connect_suppliers_dht_layer() else: lg.warn('service service_entangled_dht is OFF') events.add_subscriber(self._on_dht_layer_connected, event_id='dht-layer-connected') return True
def start(self): from twisted.internet.defer import Deferred from transport import callback from main import events from main import listeners from p2p import online_status from p2p import p2p_service from p2p import p2p_connector from p2p import network_connector from p2p import ratings p2p_service.init() online_status.init() ratings.init() self._starting_defer = Deferred() p2p_connector.A('init') p2p_connector.A().addStateChangedCallback( self._on_p2p_connector_switched) network_connector.A().addStateChangedCallback( self._on_network_connector_switched) callback.append_inbox_callback(self._on_inbox_packet_received) callback.append_inbox_callback(p2p_service.inbox) events.add_subscriber(self._on_identity_url_changed, 'identity-url-changed') events.add_subscriber(self._on_my_identity_url_changed, 'my-identity-url-changed') if listeners.is_populate_requered('online_status'): listeners.populate_later().remove('online_status') online_status.populate_online_statuses() return True
def doInit(self, arg): """ Action method. """ callback.append_inbox_callback(self._on_inbox_packet) if arg: self.new_coin_filter_method, self.offline_mode = arg
def start(self): from transport import callback from main import events from contacts import contactsdb from storage import accounting callback.append_inbox_callback(self._on_inbox_packet_received) events.add_subscriber(self._on_customer_accepted, 'existing-customer-accepted') events.add_subscriber(self._on_customer_accepted, 'new-customer-accepted') events.add_subscriber(self._on_customer_terminated, 'existing-customer-denied') events.add_subscriber(self._on_customer_terminated, 'existing-customer-terminated') space_dict = accounting.read_customers_quotas() for customer_idurl in contactsdb.customers(): known_customer_meta_info = contactsdb.get_customer_meta_info( customer_idurl) events.send('existing-customer-accepted', data=dict( idurl=customer_idurl, allocated_bytes=space_dict.get(customer_idurl), ecc_map=known_customer_meta_info.get('ecc_map'), position=known_customer_meta_info.get('position'), )) return True
def doInit(self, *args, **kwargs): """ Action method. """ callback.append_inbox_callback(self._on_inbox_packet) if args and args[0]: self.new_coin_filter_method, self.offline_mode = args[0]
def doInit(self, *args, **kwargs): version_number = bpio.ReadTextFile( settings.VersionNumberFile()).strip() if _Debug: lg.out( _DebugLevel - 6, 'p2p_connector.doInit RevisionNumber=%s' % str(version_number)) callback.append_inbox_callback(inbox)
def doInit(self, *args, **kwargs): """ Action method. """ callback.append_inbox_callback(self._inbox_packet_received) self.family_position = kwargs.get('family_position') self.ecc_map = kwargs.get('ecc_map') self.family_snapshot = kwargs.get('family_snapshot')
def start(self): from twisted.internet.task import LoopingCall from transport import callback from stream import p2p_queue p2p_queue.init() callback.append_inbox_callback(self._on_inbox_packet_received) self.reconnect_task = LoopingCall(self._on_check_network_connect) self.reconnect_task.start(30, now=False) return True
def start(self): from main import events from transport import callback callback.append_inbox_callback(self._on_inbox_packet_received) events.add_subscriber(self._on_supplier_modified, 'supplier-modified') events.add_subscriber(self._on_my_list_files_refreshed, 'my-list-files-refreshed') events.add_subscriber(self._on_key_erased, 'key-erased') self._do_open_known_shares() return True
def start(self): from supplier import customer_assistant from contacts import contactsdb from transport import callback for customer_idurl in contactsdb.customers(): if customer_idurl and not customer_assistant.by_idurl(customer_idurl): ca = customer_assistant.create(customer_idurl) ca.automat('init') callback.add_outbox_callback(self._on_outbox_packet_sent) callback.append_inbox_callback(self._on_inbox_packet_received) return True
def start(self): from transport import callback from main import listeners from crypt import my_keys from access import key_ring key_ring.init() callback.add_outbox_callback(self._on_outbox_packet_sent) callback.append_inbox_callback(self._on_inbox_packet_received) if listeners.is_populate_requered('key'): listeners.populate_later().remove('key') my_keys.populate_keys() return True
def start(self): from transport import callback from chat import message from chat import message_keeper from chat import message_db from chat import nickname_holder message.init() message_db.init() nickname_holder.A('set') callback.append_inbox_callback(self._on_inbox_packet_received) message_keeper.init() return True
def start(self): from main import events from transport import callback from stream import message from chat import nickname_holder message.init() nickname_holder.A('set') callback.append_inbox_callback(self._on_inbox_packet_received) events.add_subscriber(self._on_identity_url_changed, 'identity-url-changed') events.add_subscriber(self._on_user_connected, 'node-connected') events.add_subscriber(self._on_user_disconnected, 'node-disconnected') return True
def start(self): from transport import callback from main import events from contacts import contactsdb callback.append_inbox_callback(self._on_inbox_packet_received) events.add_subscriber(self._on_customer_accepted, 'existing-customer-accepted') events.add_subscriber(self._on_customer_accepted, 'new-customer-accepted') events.add_subscriber(self._on_customer_terminated, 'existing-customer-denied') events.add_subscriber(self._on_customer_terminated, 'existing-customer-terminated') for customer_idurl in contactsdb.customers(): events.send('existing-customer-accepted', data=dict(idurl=customer_idurl)) return True
def start(self): from transport import callback from p2p import contact_status from p2p import p2p_service from p2p import p2p_connector from p2p import network_connector from twisted.internet.defer import Deferred p2p_service.init() contact_status.init() self._starting_defer = Deferred() p2p_connector.A('init') p2p_connector.A().addStateChangedCallback( self._on_p2p_connector_switched) network_connector.A().addStateChangedCallback( self._on_network_connector_switched) callback.append_inbox_callback(self._on_inbox_packet_received) callback.append_inbox_callback(p2p_service.inbox) return True
def start(self): from twisted.internet import reactor # @UnresolvedImport from userid import id_url from main import events from supplier import customer_assistant from contacts import contactsdb from transport import callback for customer_idurl in contactsdb.customers(): if id_url.is_cached(customer_idurl): if customer_idurl and not customer_assistant.by_idurl( customer_idurl): ca = customer_assistant.create(customer_idurl) reactor.callLater(0, ca.automat, 'init') # @UndefinedVariable events.add_subscriber(self._on_identity_url_changed, 'identity-url-changed') callback.add_outbox_callback(self._on_outbox_packet_sent) callback.append_inbox_callback(self._on_inbox_packet_received) return True
def start(self): from twisted.internet import reactor # @UnresolvedImport from logs import lg from main import events from contacts import contactsdb from userid import id_url from supplier import family_member from transport import callback from userid import my_id callback.append_inbox_callback(self._on_inbox_packet_received) for customer_idurl in contactsdb.customers(): if not customer_idurl: continue if not id_url.is_cached(customer_idurl): continue if customer_idurl == my_id.getLocalID(): lg.warn('skipping my own identity') continue fm = family_member.by_customer_idurl(customer_idurl) if not fm: fm = family_member.create_family(customer_idurl) fm.automat('init') local_customer_meta_info = contactsdb.get_customer_meta_info( customer_idurl) reactor.callLater(0, fm.automat, 'family-join', { # @UndefinedVariable 'supplier_idurl': my_id.getLocalID().to_bin(), 'ecc_map': local_customer_meta_info.get('ecc_map'), 'position': local_customer_meta_info.get('position', -1), 'family_snapshot': id_url.to_bin_list(local_customer_meta_info.get('family_snapshot')), }) events.add_subscriber(self._on_identity_url_changed, 'identity-url-changed') events.add_subscriber(self._on_existing_customer_accepted, 'existing-customer-accepted') events.add_subscriber(self._on_new_customer_accepted, 'new-customer-accepted') events.add_subscriber(self._on_existing_customer_terminated, 'existing-customer-terminated') return True
def init(root=None, path='traffic', port=9997): global _WebListener if root is not None: from transport import callback callback.append_inbox_callback(inbox) callback.add_finish_file_sending_callback(outbox) root.putChild(path, TrafficPage()) return if _WebListener: return root = resource.Resource() root.putChild('', TrafficPage()) site = server.Site(root) try: _WebListener = reactor.listenTCP(port, site) except: from logs import lg lg.exc() return from transport import callback callback.append_inbox_callback(inbox) callback.add_finish_file_sending_callback(outbox)
def doInit(self, arg): """ Action method. """ callback.append_inbox_callback(self._on_inbox_packet)
def doInit(self, *args, **kwargs): """ Action method. """ callback.append_inbox_callback(self._inbox_packet_received)
def init(): if _Debug: lg.out(_DebugLevel, 'p2p_service.init') callback.append_inbox_callback(inbox)
def start(self): from transport import callback callback.append_inbox_callback(self._on_inbox_packet_received) return True
def start(self): from transport import callback from p2p import p2p_queue p2p_queue.init() callback.append_inbox_callback(self._on_inbox_packet_received) return True
def doInit(self, arg): """ Action method. """ self.exclude_nodes = arg[0] callback.append_inbox_callback(self._inbox_packet_received)
def doInit(self, *args, **kwargs): """ Action method. """ self.incoming_broadcast_message_callback = args[0] callback.append_inbox_callback(self._on_inbox_packet)
def start(self): from main import events from transport import callback callback.append_inbox_callback(self._on_inbox_packet_received) events.add_subscriber(self._on_supplier_modified, 'supplier-modified') return True
def doInit(self, arg): """ Action method. """ self.incoming_broadcast_message_callback = arg callback.append_inbox_callback(self._on_inbox_packet)
def init(): if _Debug: lg.out(_DebugLevel, "p2p_service.init") callback.append_inbox_callback(inbox)