Esempio n. 1
0
 def _start_scann(self):
     from base_settings import base_settings
     bs = base_settings()
     bs.scan = False
     last = self.find_last_wav()
     first = (self.last_seen!="None" and self.last_seen or "000000000000000")
     self._log.write(self.__class__.__name__, "Fs Sync found %s, %s"%(first, last), "INFO")
     self._get_file_info(first, last, bs.send_records)
     bs.send_scan_done(self.code)
Esempio n. 2
0
    def __init__(self, descriptor):
        DLocalFold.__init__(self, descriptor)
        self.rpath = descriptor["rpath"]
        self.uname = descriptor["uname"]
        if not self._check_mounted():
            self._try_to_mount()
            if not self._check_mounted():
                ## trouble mounting remote
                from base_settings import base_settings

                bs = base_settings()
                self._log.write("SshFold", "can't mount remote %s:%s" % (self.ip, self.code), "ERR")
                bs.send_notify("SshFold: can't mount remote %s:%s" % (self.ip, self.code), "ERR")
Esempio n. 3
0
    def _recheck(self):
        from base_settings import base_settings
        bs = base_settings()
        if self.last_seen == "None":
            return 0
        last = self.last_seen
        b = branchManager()
        b.set_path(last)

        first = str(long(self.last_seen)-self.bc).zfill(15)
        if first < b.min():
            first = b.get_path()
        self._log.write(self.__class__.__name__, "Starting Recheck %s, %s , %s"%(first, last, self.bc), "INFO")
        self._get_file_info(first, last, bs.send_revisited_records)
Esempio n. 4
0
 def run_sync(self):
     from base_settings import base_settings
     bs = base_settings()
     tmp = bs.dest.get_temp()
     if self.need_tmp:  # definisce se serve effettivamente il file tmp
         if tmp == None:
             self._log.write("NEED TMP", "USE ORIGIN TMP", "INFO")
     else:
         tmp = None
     while 1:
         try:
             l = self.list_of_moves.pop(0)
             b = branchManager()
             b.set_path(l[1])
             f = os.sep.join([self.path, b.get_abs_path()])
             if tmp != None:
                 self._log.write("NEED TMP", "Move to tmp", "INFO")
                 f2 = os.sep.join([tmp, b.get_path()])
                 self.push(f, f2);
                 f = f2
                 # sposto ed f diventa il percorso da tmp
             try:
                 bs.dest.push(f, l[1])
                 self.list_of_moved.append(l[0])
                 if self.list_of_moved.__len__() > self.m_limit:
                     tmp = self.list_of_moved
                     self.list_of_moved = []
                     bs.send_ack(tmp)
             except:
                 pass
         except IndexError, e:
             self.is_running = False
             tmp = self.list_of_moved
             self.list_of_moved = []
             bs.send_ack(tmp)
             break
Esempio n. 5
0
#from xml.marshal import *
from twisted.internet import reactor
#from twisted.web import client
from base_settings import base_settings


http_serv = "localhost"
http_port = 8080


if __name__=="__main__":
    bs = base_settings(http_serv, http_port)
    reactor.run()
Esempio n. 6
0
 def run_full_sync(self):
     from base_settings import base_settings
     base_settings().full_sync()