summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-02-19 01:47:44 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-02-19 01:47:44 +0000
commit241a8cb9d9df719d5703005557c5fb23ffeae98f (patch)
tree219167a4251dee767e3282b38076c33a2d151796
parent716fa96b9cbf2570e381de0abb475d341487c2d6 (diff)
downloadrdiff-backup-241a8cb9d9df719d5703005557c5fb23ffeae98f.tar.gz
Removed CIP code (expanded to CCPP in backup.py)
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@282 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/rdiff_backup/rorpiter.py47
1 files changed, 0 insertions, 47 deletions
diff --git a/rdiff-backup/rdiff_backup/rorpiter.py b/rdiff-backup/rdiff_backup/rorpiter.py
index 072478f..aebb6fc 100644
--- a/rdiff-backup/rdiff_backup/rorpiter.py
+++ b/rdiff-backup/rdiff_backup/rorpiter.py
@@ -425,50 +425,3 @@ class CacheIndexable:
except KeyError:
assert index > self.cache_indicies[0], index
return None
-
-
-class CachedIndexableProcessor:
- """Reorder indicies, then feed into some function in order
-
- Use this class when you want to run some function on a stream of
- objects in index order. However, the objects may be slightly out
- of index order. This class will cache a certain number, and then
- reorder them.
-
- An error is signaled if the indicies arrive too out of order.
-
- """
- def __init__(self, function, cache_size):
- """CIP initializer. function is called on every elem."""
- self.function = function
- self.cache_size = cache_size
- self.cache_indicies = []
- self.cache_dict = {}
-
- def process(self, elem):
- """Call CIP (and underlying self.function) on indexed elem"""
- index = elem.index
- self.cache_dict[index] = elem
- if self.cache_indicies and index <= self.cache_indicies[-1]:
- assert index > self.cache_indicies[0]
- self.cache_indicies.append(index)
- self.cache_indicies.sort() # Ack, n log n, should be log n!!!
- else: self.cache_indicies.append(index)
-
- if len(self.cache_indicies) > self.cache_size:
- first_index = self.cache_indicies[0]
- first_elem = self.cache_dict[first_index]
- del self.cache_indicies[0]
- del self.cache_dict[first_index]
- self.function(first_elem)
-
- __call__ = process
-
- def close(self):
- """Flush cache by running function on remaining elems"""
- while self.cache_indicies:
- index = self.cache_indicies[0]
- elem = self.cache_dict[index]
- del self.cache_indicies[0]
- del self.cache_dict[index]
- self.function(elem)