Exemple #1
0
	def writeTo(self, filesystem):
		if filesystem.writeback_time != '-1':
			time.sleep(filesystem.writeback_time)
		
		self.iolock.acquire()
		if self.pending_delete == True:
			self.dirty = False
			self.iolock.release()
			return
		if self.openref > 0:
			self.iolock.release()
			return
		if self.stat.st_size == 0:
			self.iolock.release()
			return
		self.sha_sum = filesystem.cache.hash(self)
		update_stat = filesystem.cache.statInCache(self)		
		self.stat.st_atime = update_stat.st_atime
		self.stat.st_mtime = update_stat.st_mtime
		self.stat.st_ctime = update_stat.st_ctime
		if self.parent != None:
			self.parent.stat.st_atime = update_stat.st_atime
			self.parent.stat.st_mtime = update_stat.st_mtime
			self.parent.stat.st_ctime = update_stat.st_ctime


		fn = tools.makefilename( self.sha_sum, filesystem.persistence )		
		if not os.path.isfile(fn):
			shutil.copy(filesystem.cache.fn(self),fn)			
		self.dirty = False
		self.iolock.release()
		return
Exemple #2
0
    def writeTo(self, filesystem):
        if filesystem.writeback_time != '-1':
            time.sleep(filesystem.writeback_time)

        self.iolock.acquire()
        if self.pending_delete == True:
            self.dirty = False
            self.iolock.release()
            return
        if self.openref > 0:
            self.iolock.release()
            return
        if self.stat.st_size == 0:
            self.iolock.release()
            return
        self.sha_sum = filesystem.cache.hash(self)
        update_stat = filesystem.cache.statInCache(self)
        self.stat.st_atime = update_stat.st_atime
        self.stat.st_mtime = update_stat.st_mtime
        self.stat.st_ctime = update_stat.st_ctime
        if self.parent != None:
            self.parent.stat.st_atime = update_stat.st_atime
            self.parent.stat.st_mtime = update_stat.st_mtime
            self.parent.stat.st_ctime = update_stat.st_ctime

        fn = tools.makefilename(self.sha_sum, filesystem.persistence)
        if not os.path.isfile(fn):
            shutil.copy(filesystem.cache.fn(self), fn)
        self.dirty = False
        self.iolock.release()
        return
Exemple #3
0
	def readFrom(self, filesystem):
		if self.sha_sum == '':
			self.stat.st_size = 0
			return
		fn = tools.makefilename( self.sha_sum, filesystem.persistence )
		if os.path.isfile(fn):
			self.iolock.acquire()
			shutil.copy(fn,filesystem.cache.fn(self))
			self.iolock.release()
			filesystem.cache.addToCache(self,os.O_RDWR)
		else:
			syslog.syslog(syslog.LOG_WARNING, "sha_sum = "+self.sha_sum+"not in persistence")
Exemple #4
0
 def readFrom(self, filesystem):
     if self.sha_sum == '':
         self.stat.st_size = 0
         return
     fn = tools.makefilename(self.sha_sum, filesystem.persistence)
     if os.path.isfile(fn):
         self.iolock.acquire()
         shutil.copy(fn, filesystem.cache.fn(self))
         self.iolock.release()
         filesystem.cache.addToCache(self, os.O_RDWR)
     else:
         syslog.syslog(syslog.LOG_WARNING,
                       "sha_sum = " + self.sha_sum + "not in persistence")
Exemple #5
0
	def isOnPersistence(self, filesystem):
		fn = tools.makefilename( self.sha_sum, filesystem.persistence )
		return os.path.isfile(fn)
Exemple #6
0
 def isOnPersistence(self, filesystem):
     fn = tools.makefilename(self.sha_sum, filesystem.persistence)
     return os.path.isfile(fn)