mirror of
https://github.com/octoleo/restic.git
synced 2024-11-22 12:55:18 +00:00
Add Len() functions for IDSet and Map
This commit is contained in:
parent
4d1e7b9f24
commit
c631b5c738
@ -66,3 +66,10 @@ func (s *IDSet) Find(id ID) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *IDSet) Len() int {
|
||||
s.m.Lock()
|
||||
defer s.m.Unlock()
|
||||
|
||||
return len(s.list)
|
||||
}
|
||||
|
8
map.go
8
map.go
@ -140,6 +140,14 @@ func (bl *Map) Equals(other *Map) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Len returns the number of blobs in the map.
|
||||
func (bl *Map) Len() int {
|
||||
bl.m.Lock()
|
||||
defer bl.m.Unlock()
|
||||
|
||||
return len(bl.list)
|
||||
}
|
||||
|
||||
// Prune deletes all IDs from the map except the ones listed in ids.
|
||||
func (m *Map) Prune(ids *backend.IDSet) {
|
||||
m.m.Lock()
|
||||
|
Loading…
Reference in New Issue
Block a user