Revision cfe6939d pithos/backends/simple.py

b/pithos/backends/simple.py
211 211
    def update_object_hashmap(self, account, container, name, size, hashmap):
212 212
        """Create/update an object with the specified size and partial hashes."""
213 213
        
214
        logger.debug("update_object_hashmap: %s %s %s %s", account, container, name, hashmap)
214
        logger.debug("update_object_hashmap: %s %s %s %s %s", account, container, name, size, hashmap)
215 215
        path, link, tstamp = self._get_containerinfo(account, container)
216 216
        try:
217 217
            path, link, tstamp, version, s = self._get_objectinfo(account, container, name)
......
224 224
            self._del_path(path, delmeta=False)
225 225
            link = self._put_linkinfo(path)
226 226
        else:
227
            version = version + 1
227
            version += 1
228 228
        
229 229
        sql = 'insert or replace into versions (object_id, version, size) values (?, ?, ?)'
230 230
        version_id = self.con.execute(sql, (link, version, size)).lastrowid
......
266 266
    def get_block(self, hash):
267 267
        """Return a block's data."""
268 268
        
269
        logger.debug("get_block: %s", hash)
269 270
        c = self.con.execute('select data from blocks where block_id = ?', (hash,))
270 271
        row = c.fetchone()
271 272
        if row:
......
276 277
    def put_block(self, data):
277 278
        """Create a block and return the hash."""
278 279
        
280
        logger.debug("put_block: %s", len(data))
279 281
        h = hashlib.new(self.hash_algorithm)
280 282
        h.update(data.rstrip('\x00'))
281 283
        hash = h.hexdigest()
......
287 289
    def update_block(self, hash, data, offset=0):
288 290
        """Update a known block and return the hash."""
289 291
        
292
        logger.debug("update_block: %s %s %s", hash, len(data), offset)
293
        if offset == 0 and len(data) == self.block_size:
294
            return self.put_block(data)
290 295
        src_data = self.get_block(hash)
291 296
        bs = self.block_size
292 297
        if offset < 0 or offset > bs or offset + len(data) > bs:

Also available in: Unified diff