Пример #1
0
    def AddHashEntry(self, hash_entry, timestamp):
        if timestamp in self._hash_entries:
            message = (
                "Duplicated hash entry write for path '%s' of type '%s' at "
                "timestamp '%s'. Old: %s. New: %s.")
            message %= ("/".join(self._path_info.components),
                        self._path_info.path_type, timestamp,
                        self._hash_entries[timestamp], hash_entry)
            raise db.Error(message)

        self._hash_entries[timestamp] = hash_entry.Copy()
Пример #2
0
    def AddHashEntry(self, hash_entry, timestamp):
        """Registers hash entry at a given timestamp."""

        if timestamp in self._hash_entries:
            message = (
                "Duplicated hash entry write for path '%s' of type '%s' at "
                "timestamp '%s'. Old: %s. New: %s.")
            message %= ("/".join(self._components), self._path_type, timestamp,
                        self._hash_entries[timestamp], hash_entry)
            raise db.Error(message)

        if timestamp not in self._path_infos:
            path_info = rdf_objects.PathInfo(path_type=self._path_type,
                                             components=self._components,
                                             timestamp=timestamp,
                                             hash_entry=hash_entry)
            self.AddPathInfo(path_info)
        else:
            self._path_infos[timestamp].hash_entry = hash_entry