lib/db, lib/model: Remove filesystem state from FileSet (fixes #7850) (#8151)

This commit is contained in:
Simon Frei
2022-01-31 10:12:52 +01:00
committed by GitHub
parent d1e81a0acf
commit 635085d139
11 changed files with 70 additions and 80 deletions
+3 -4
View File
@@ -11,7 +11,6 @@ import (
"testing"
"github.com/syncthing/syncthing/lib/db"
"github.com/syncthing/syncthing/lib/fs"
"github.com/syncthing/syncthing/lib/protocol"
)
@@ -47,7 +46,7 @@ func getBenchFileSet(b testing.TB) (*db.Lowlevel, *db.FileSet) {
lazyInitBenchFiles()
ldb := newLowlevelMemory(b)
benchS := newFileSet(b, "test)", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
benchS := newFileSet(b, "test)", ldb)
replace(benchS, remoteDevice0, files)
replace(benchS, protocol.LocalDeviceID, firstHalf)
@@ -60,7 +59,7 @@ func BenchmarkReplaceAll(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
m := newFileSet(b, "test)", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
m := newFileSet(b, "test)", ldb)
replace(m, protocol.LocalDeviceID, files)
}
@@ -202,7 +201,7 @@ func BenchmarkNeedHalf(b *testing.B) {
func BenchmarkNeedHalfRemote(b *testing.B) {
ldb := newLowlevelMemory(b)
defer ldb.Close()
fset := newFileSet(b, "test)", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
fset := newFileSet(b, "test)", ldb)
replace(fset, remoteDevice0, firstHalf)
replace(fset, protocol.LocalDeviceID, files)