Cache blobs for each snapshot

This commit is contained in:
Alexander Neumann committed 2015-03-09 23:50:32 +01:00
1 parent b2cce7f051
commit 14298fe232
6 files changed
+98 -136

No files matched your search

+11
View File
@@ -140,6 +140,17 @@ func (bl *Map) Equals(other *Map) bool {
return true
}
// Each calls f for each blob in the Map. While Each is running, no other
// operation is possible, since a mutex is held for the whole time.
func (bl *Map) Each(f func(blob Blob)) {
bl.m.Lock()
defer bl.m.Unlock()
for _, blob := range bl.list {
f(blob)
}
}
// Select returns a list of of blobs from the plaintext IDs given in list.
func (bl *Map) Select(list backend.IDs) (Blobs, error) {
bl.m.Lock()