Refactor backup pipeline

This commit is contained in:
Alexander Neumann
2015-03-08 14:16:01 +01:00
parent 1516cb5996
commit ba892e1ec2
9 changed files with 536 additions and 105 deletions
+18
View File
@@ -140,6 +140,24 @@ func (bl *Map) Equals(other *Map) bool {
return true
}
// 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()
defer bl.m.Unlock()
blobs := make(Blobs, 0, len(list))
for _, id := range list {
_, blob, err := bl.find(Blob{ID: id}, false)
if err != nil {
return nil, err
}
blobs = append(blobs, blob)
}
return blobs, nil
}
// Len returns the number of blobs in the map.
func (bl *Map) Len() int {
bl.m.Lock()