Example #1
0
    def close(self):
        """close the file and make it visible in the database"""
        self.sync()
        os.close(self._value_file_fd)

        if self._segment_sequence_count == 0:
            self._log.info("removing empty file %s" %
                           (self._value_file_path, ))
            try:
                os.unlink(self._value_file_path)
            except Exception:
                pass
            return

        self._log.info(
            "closing %s size=%s segment_sequence_count=%s" %
            (self._value_file_path, self._size, self._segment_sequence_count))
        value_file_row = value_file_template(
            id=self._value_file_id,
            space_id=self._space_id,
            creation_time=self._creation_time,
            close_time=create_timestamp(),
            size=self._size,
            hash=psycopg2.Binary(self._md5.digest()),
            segment_sequence_count=self._segment_sequence_count,
            min_segment_id=self._min_segment_id,
            max_segment_id=self._max_segment_id,
            distinct_collection_count=len(self._collection_ids),
            collection_ids=sorted(list(self._collection_ids)),
            garbage_size_estimate=0,
            fragmentation_estimate=0,
            last_cleanup_check_time=None,
            last_integrity_check_time=None)
        _update_value_file_row(self._connection, value_file_row)
    def close(self):
        """close the file and make it visible in the database"""
        self._log.debug("closing %s size=%s segment_sequence_count=%s" % (
            self._value_file_path, self._size, self._segment_sequence_count
        )) 

        os.fsync(self._value_file_fd)
        os.close(self._value_file_fd)

        value_file_row = value_file_template(
            id=self._value_file_id,
            creation_time=self._creation_time,
            close_time=datetime.now(),
            size=self._size,
            hash=psycopg2.Binary(self._md5.digest()),
            segment_sequence_count=self._segment_sequence_count,
            min_segment_id=self._min_segment_id,
            max_segment_id=self._max_segment_id,
            distinct_collection_count=len(self._collection_ids),
            collection_ids=sorted(list(self._collection_ids)),
            garbage_size_estimate=0,
            fragmentation_estimate=0,
            last_cleanup_check_time=None,
            last_integrity_check_time=None
        )
        _insert_value_file_row(self._connection, value_file_row)
Example #3
0
    def close(self):
        """close the file and make it visible in the database"""
        self.sync()
        os.close(self._value_file_fd)

        if self._segment_sequence_count == 0:
            self._log.info("removing empty file %s" % (self._value_file_path,))
            try:
                os.unlink(self._value_file_path)
            except Exception:
                pass
            return

        self._log.info("closing %s size=%s segment_sequence_count=%s" % (
            self._value_file_path, self._size, self._segment_sequence_count
        ))
        value_file_row = value_file_template(
            id=self._value_file_id,
            space_id=self._space_id,
            creation_time=self._creation_time,
            close_time=create_timestamp(),
            size=self._size,
            hash=psycopg2.Binary(self._md5.digest()),
            segment_sequence_count=self._segment_sequence_count,
            min_segment_id=self._min_segment_id,
            max_segment_id=self._max_segment_id,
            distinct_collection_count=len(self._collection_ids),
            collection_ids=sorted(list(self._collection_ids)),
            garbage_size_estimate=0,
            fragmentation_estimate=0,
            last_cleanup_check_time=None,
            last_integrity_check_time=None
        )
        _update_value_file_row(self._connection, value_file_row)
Example #4
0
    def close(self):
        """close the file and make it visible in the database"""
        self._log.debug(
            "closing %s size=%s segment_sequence_count=%s" %
            (self._value_file_path, self._size, self._segment_sequence_count))

        os.fsync(self._value_file_fd)
        os.close(self._value_file_fd)

        value_file_row = value_file_template(
            id=self._value_file_id,
            space_id=self._space_id,
            creation_time=self._creation_time,
            close_time=create_timestamp(),
            size=self._size,
            hash=psycopg2.Binary(self._md5.digest()),
            segment_sequence_count=self._segment_sequence_count,
            min_segment_id=self._min_segment_id,
            max_segment_id=self._max_segment_id,
            distinct_collection_count=len(self._collection_ids),
            collection_ids=sorted(list(self._collection_ids)),
            garbage_size_estimate=0,
            fragmentation_estimate=0,
            last_cleanup_check_time=None,
            last_integrity_check_time=None)
        _insert_value_file_row(self._connection, value_file_row)