Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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 import settings
     from main.config import conf
     from p2p import p2p_connector
     backup_fs.init()
     backup_control.init()
     backup_matrix.init()
     if settings.NewWebGUI():
         from web import control
         backup_matrix.SetBackupStatusNotifyCallback(control.on_backup_stats)
         backup_matrix.SetLocalFilesNotifyCallback(control.on_read_local_files)
     else:
         from web import webcontrol
         backup_matrix.SetBackupStatusNotifyCallback(webcontrol.OnBackupStats)
         backup_matrix.SetLocalFilesNotifyCallback(webcontrol.OnReadLocalFiles)
     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')
     return True
Exemplo n.º 3
0
 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 import settings
     from main.config import conf
     from p2p import p2p_connector
     backup_fs.init()
     backup_control.init()
     backup_matrix.init()
     if settings.NewWebGUI():
         from web import control
         backup_matrix.SetBackupStatusNotifyCallback(
             control.on_backup_stats)
         backup_matrix.SetLocalFilesNotifyCallback(
             control.on_read_local_files)
     else:
         from web import webcontrol
         backup_matrix.SetBackupStatusNotifyCallback(
             webcontrol.OnBackupStats)
         backup_matrix.SetLocalFilesNotifyCallback(
             webcontrol.OnReadLocalFiles)
     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')
     return True
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 def setUp(self):
     try:
         bpio.rmdir_recursive('/tmp/.bitdust_tmp')
     except Exception:
         pass
     lg.set_debug_level(30)
     settings.init(base_dir='/tmp/.bitdust_tmp')
     self.my_current_key = None
     try:
         os.makedirs('/tmp/.bitdust_tmp/metadata/')
     except:
         pass
     fout = open('/tmp/_some_priv_key', 'w')
     fout.write(_some_priv_key)
     fout.close()
     fout = open(settings.LocalIdentityFilename(), 'w')
     fout.write(_some_identity_xml)
     fout.close()
     self.assertTrue(key.LoadMyKey(keyfilename='/tmp/_some_priv_key'))
     self.assertTrue(my_id.loadLocalIdentity())
     backup_fs.init()
Exemplo n.º 6
0
        return succeed((REQ_FILE_ACTN_COMPLETED_OK,))

#------------------------------------------------------------------------------

class BitDustFTPFactory(FTPFactory):
    """
    """
    protocol = BitDustFTP


#------------------------------------------------------------------------------

if __name__ == "__main__":
    lg.set_debug_level(20)
    settings.init()
    backup_fs.init()
    backup_control.init()
    # print backup_fs.IsDir('/Users')
    init()
    reactor.run()  # @UndefinedVariable
    settings.shutdown()




#     def ftp_NLST(self, path):
#         """
#         """
#         print 'ftp_NLST:', path
#         # XXX: why is this check different from ftp_RETR/ftp_STOR? See #4180
#         if self.dtpInstance is None or not self.dtpInstance.isConnected: