Revision 6f6cec5a snf-pithos-tools/pithos/tools/lib/hashmap.py

b/snf-pithos-tools/pithos/tools/lib/hashmap.py
32 32
# or implied, of GRNET S.A.
33 33

  
34 34
import hashlib
35
import os
35 36

  
36 37
from binascii import hexlify
37 38

  
39
from progress.bar import IncrementalBar
38 40

  
39 41
def file_read_iterator(fp, size=1024):
40 42
    while True:
......
75 77
    
76 78
    def load(self, fp):
77 79
        self.size = 0
78
        for block in file_read_iterator(fp, self.blocksize):
80
        file_size = os.fstat(fp.fileno()).st_size
81
        nblocks = 1 + (file_size - 1) // self.blocksize
82
        bar = IncrementalBar('Computing', max=nblocks)
83
        bar.suffix = '%(percent).1f%% - %(eta)ds'
84
        for block in bar.iter(file_read_iterator(fp, self.blocksize)):
79 85
            self.append(self._hash_block(block))
80 86
            self.size += len(block)
81 87

  

Also available in: Unified diff