~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/meta_store.py

  • Committer: John Arbash Meinel
  • Date: 2005-07-12 08:13:33 UTC
  • mto: (1185.11.1)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: john@arbash-meinel.com-20050712081333-9e338d493dcec086
Had to update CachedStore a little bit more. for full Storage semantics.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
from trace import mutter
18
 
from bzrlib.store import Store, CompressedTextStore
 
18
from bzrlib.store import Storage, CompressedTextStore
19
19
from bzrlib.local_transport import LocalTransport
20
20
 
21
21
try:
23
23
except NameError:
24
24
    from sets import Set as set
25
25
 
26
 
class CachedStore(Store):
 
26
class CachedStore(Storage):
27
27
    """A store that caches data locally, to avoid repeated downloads.
28
28
    The precacache method should be used to avoid server round-trips for
29
29
    every piece of data.
46
46
            return True
47
47
        return False
48
48
 
49
 
    def get(self, fileids):
 
49
    def get(self, fileids, pb=None):
50
50
        fileids = list(fileids)
51
51
        hasids = self.cache_store.has(fileids)
52
52
        needs = set()
55
55
                needs.add(fileid)
56
56
        if needs:
57
57
            self.cache_store.copy_multi(self.source_store, needs)
58
 
        return self.cache_store.get(fileids)
 
58
        return self.cache_store.get(fileids, pb=pb)
59
59
 
60
60
    def prefetch(self, ids):
61
61
        """Copy a series of ids into the cache, before they are used.