示例#1
0
 def GetComponentInformation(self):
   """Return number of components and average size per component."""
   loc = self.GetLocation()
   if not os.path.exists(loc) or not os.path.isdir(loc):
     return 0, 0
   size, files = common.DatabaseDirectorySize(loc, self.db.FileExtension())
   if files:
     return files, int(float(size) / float(files))
   return 0, 0
示例#2
0
 def Size(self):
   root_path = self.Location()
   if not os.path.exists(root_path):
     # Database does not exist yet.
     return 0
   if not os.path.isdir(root_path):
     # Database should be a directory.
     raise IOError("expected SQLite directory %s to be a directory" %
                   root_path)
   size, _ = common.DatabaseDirectorySize(root_path, self.FileExtension())
   return size