コード例 #1
0
 def __init__(self, port, root_dir, data_dir, partials_dir, dns_srv=None):
     self.root_dir = root_dir
     self.shares_dir = os.path.join(os.path.dirname(root_dir), 'shares_dir')
     self.shares_dir_link = os.path.join(root_dir, 'shares_link')
     self.data_dir = data_dir
     self.fsmdir = os.path.join(data_dir, 'fsmdir')
     self.partials_dir = partials_dir
     self.tritcask_dir = os.path.join(self.data_dir, 'tritcask')
     self.hash_q = type(
         'fake hash queue', (), {
             'empty': staticmethod(lambda: True),
             '__len__': staticmethod(lambda: 0)
         })()
     self.logger = logging.getLogger('fsyncsrvr.SyncDaemon.Main')
     self.db = tritcask.Tritcask(self.tritcask_dir)
     self.vm = DumbVolumeManager(self)
     self.fs = FileSystemManager(self.fsmdir, self.partials_dir, self.vm,
                                 self.db)
     self.event_q = EventQueue(self.fs)
     self.event_q.subscribe(self.vm)
     self.fs.register_eq(self.event_q)
     self.sync = Sync(self)
     self.action_q = ActionQueue(self.event_q,
                                 self,
                                 '127.0.0.1',
                                 port,
                                 dns_srv,
                                 disable_ssl_verify=True)
     self.state_manager = main.StateManager(self, handshake_timeout=30)
     self.state_manager.connection.waiting_timeout = .1
     self.vm.init_root()
コード例 #2
0
 def __init__(self, port, root_dir, data_dir, partials_dir,
              dns_srv=None):
     self.root_dir = root_dir
     self.shares_dir = os.path.join(os.path.dirname(root_dir), 'shares_dir')
     self.shares_dir_link = os.path.join(root_dir, 'shares_link')
     self.data_dir = data_dir
     self.fsmdir = os.path.join(data_dir, 'fsmdir')
     self.partials_dir = partials_dir
     self.tritcask_dir = os.path.join(self.data_dir, 'tritcask')
     self.hash_q = type('fake hash queue', (),
                        {'empty': staticmethod(lambda: True),
                         '__len__': staticmethod(lambda: 0)})()
     self.logger = logger
     self.db = tritcask.Tritcask(self.tritcask_dir)
     self.vm = DumbVolumeManager(self)
     self.fs = FileSystemManager(self.fsmdir, self.partials_dir, self.vm,
                                 self.db)
     self.event_q = EventQueue(self.fs)
     self.event_q.subscribe(self.vm)
     self.fs.register_eq(self.event_q)
     self.sync = Sync(self)
     self.action_q = ActionQueue(self.event_q, self, '127.0.0.1', port,
                                 dns_srv, disable_ssl_verify=True)
     self.state_manager = main.StateManager(self, handshake_timeout=30)
     self.state_manager.connection.waiting_timeout = .1
     self.vm.init_root()
コード例 #3
0
class ReallyFakeMain(main.Main):
    """
    This main is so fake, it breaks nearly everything.
    """
    def __init__(self, port, root_dir, data_dir, partials_dir,
                 dns_srv=None):
        self.root_dir = root_dir
        self.shares_dir = os.path.join(os.path.dirname(root_dir), 'shares_dir')
        self.shares_dir_link = os.path.join(root_dir, 'shares_link')
        self.data_dir = data_dir
        self.fsmdir = os.path.join(data_dir, 'fsmdir')
        self.partials_dir = partials_dir
        self.tritcask_dir = os.path.join(self.data_dir, 'tritcask')
        self.hash_q = type('fake hash queue', (),
                           {'empty': staticmethod(lambda: True),
                            '__len__': staticmethod(lambda: 0)})()
        self.logger = logging.getLogger('fsyncsrvr.SyncDaemon.Main')
        self.db = tritcask.Tritcask(self.tritcask_dir)
        self.vm = DumbVolumeManager(self)
        self.fs = FileSystemManager(self.fsmdir, self.partials_dir, self.vm,
                                    self.db)
        self.event_q = EventQueue(self.fs)
        self.event_q.subscribe(self.vm)
        self.fs.register_eq(self.event_q)
        self.sync = Sync(self)
        self.action_q = ActionQueue(self.event_q, self, '127.0.0.1', port,
                                    dns_srv, disable_ssl_verify=True)
        self.state_manager = main.StateManager(self, handshake_timeout=30)
        self.state_manager.connection.waiting_timeout = .1
        self.vm.init_root()

    def server_rescan(self):
        """Fake server rescan that doesn't actually rescan anything."""
        return self.vm.server_rescan()

    def local_rescan(self):
        """Fake!"""