示例#1
0
    def update_object_count(self):
        if not self.object_info:
            self.object_info = get_container_details(self.datadir)

        objects, object_count, bytes_used = self.object_info

        if X_OBJECTS_COUNT not in self.metadata \
                or int(self.metadata[X_OBJECTS_COUNT][0]) != object_count \
                or X_BYTES_USED not in self.metadata \
                or int(self.metadata[X_BYTES_USED][0]) != bytes_used:
            self.metadata[X_OBJECTS_COUNT] = (object_count, 0)
            self.metadata[X_BYTES_USED] = (bytes_used, 0)
            write_metadata(self.datadir, self.metadata)
示例#2
0
 def update_object_count(self):
     if not self.object_info:
         self.object_info = get_container_details(self.datadir)