diff --git a/files/set.go b/files/set.go index 9065425e..2cb5bb4a 100644 --- a/files/set.go +++ b/files/set.go @@ -111,9 +111,16 @@ func (s *Set) WithHaveTruncated(node protocol.NodeID, fn fileIterator) { ldbWithHave(s.db, []byte(s.repo), node[:], true, fn) } +func (s *Set) WithGlobal(fn fileIterator) { + if debug { + l.Debugf("%s WithGlobal()", s.repo) + } + ldbWithGlobal(s.db, []byte(s.repo), false, fn) +} + func (s *Set) WithGlobalTruncated(fn fileIterator) { if debug { - l.Debugf("%s WithGlobalTrucnated()", s.repo) + l.Debugf("%s WithGlobalTruncated()", s.repo) } ldbWithGlobal(s.db, []byte(s.repo), true, fn) } diff --git a/files/set_test.go b/files/set_test.go index 5e3b0eb4..374eb9cf 100644 --- a/files/set_test.go +++ b/files/set_test.go @@ -37,7 +37,8 @@ func genBlocks(n int) []protocol.BlockInfo { func globalList(s *files.Set) []protocol.FileInfo { var fs []protocol.FileInfo - s.WithGlobal(func(f protocol.FileInfo) bool { + s.WithGlobal(func(fi protocol.FileIntf) bool { + f := fi.(protocol.FileInfo) fs = append(fs, f) return true }) @@ -46,7 +47,8 @@ func globalList(s *files.Set) []protocol.FileInfo { func haveList(s *files.Set, n protocol.NodeID) []protocol.FileInfo { var fs []protocol.FileInfo - s.WithHave(n, func(f protocol.FileInfo) bool { + s.WithHave(n, func(fi protocol.FileIntf) bool { + f := fi.(protocol.FileInfo) fs = append(fs, f) return true }) @@ -55,7 +57,8 @@ func haveList(s *files.Set, n protocol.NodeID) []protocol.FileInfo { func needList(s *files.Set, n protocol.NodeID) []protocol.FileInfo { var fs []protocol.FileInfo - s.WithNeed(n, func(f protocol.FileInfo) bool { + s.WithNeed(n, func(fi protocol.FileIntf) bool { + f := fi.(protocol.FileInfo) fs = append(fs, f) return true })