~ok2/nimbenland/nimbstor-1.0

« back to all changes in this revision

Viewing changes to nimbstor/stor.py

  • Committer: Oleksandr Kozachuk
  • Date: 2012-03-14 21:02:52 UTC
  • Revision ID: ddeus.sf@mailnull.com-20120314210252-5606p28xdxtupz2s
Better rolling checksum algorithm.

Show diffs side-by-side

added added

removed removed

Lines of Context:
325
325
    """
326
326
    while len(self._buffer) >= tosize:
327
327
      buffer = self._buffer.value()
328
 
      pos, fcks, cks = rolling_search(self._known_blocks, self._block_already_exists, buffer, BLOCK_SIZE)
 
328
      pos, cks = rolling_search(self._known_blocks, self._block_already_exists, buffer, BLOCK_SIZE)
329
329
      if pos != None:
330
330
        if pos > 0: self.commit_buffer(buffer[:pos], 0)
331
331
        data = buffer[pos:tosize]
334
334
        self._found_buffer = None
335
335
        self._checksum2 = None
336
336
        self._buffer.truncate(pos + BLOCK_SIZE)
337
 
      else: self.commit_buffer(self._buffer.pop(BLOCK_SIZE), fcks)
 
337
      else: self.commit_buffer(self._buffer.pop(BLOCK_SIZE), cks)
338
338
 
339
339
  def _finish_write(self, limit):
340
340
    if self._procslimit != None: