lib/db, lib/model: Remove dead code (#5517)

This commit is contained in:
Jakob Borg 2019-02-08 16:42:58 +01:00 committed by Simon Frei
parent cb49136269
commit 04fdafa280
2 changed files with 5 additions and 11 deletions

View File

@ -82,11 +82,6 @@ func OpenMemory() *Lowlevel {
return NewLowlevel(db, "<memory>")
}
// Location returns the filesystem path where the database is stored
func (db *Lowlevel) Location() string {
return db.location
}
// ListFolders returns the list of folders currently in the database
func (db *Lowlevel) ListFolders() []string {
return db.folderIdx.Values()

View File

@ -972,7 +972,6 @@ func (m *Model) ClusterConfig(deviceID protocol.DeviceID, cm protocol.ClusterCon
panic("bug: ClusterConfig called on closed or nonexistent connection")
}
dbLocation := filepath.Dir(m.db.Location())
changed := false
deviceCfg := m.cfg.Devices()[deviceID]
@ -1097,7 +1096,7 @@ func (m *Model) ClusterConfig(deviceID protocol.DeviceID, cm protocol.ClusterCon
}
}
go sendIndexes(conn, folder.ID, fs, m.folderIgnores[folder.ID], startSequence, dbLocation, dropSymlinks)
go sendIndexes(conn, folder.ID, fs, m.folderIgnores[folder.ID], startSequence, dropSymlinks)
}
m.pmut.Lock()
@ -1833,7 +1832,7 @@ func (m *Model) receivedFile(folder string, file protocol.FileInfo) {
m.folderStatRef(folder).ReceivedFile(file.Name, file.IsDeleted())
}
func sendIndexes(conn protocol.Connection, folder string, fs *db.FileSet, ignores *ignore.Matcher, prevSequence int64, dbLocation string, dropSymlinks bool) {
func sendIndexes(conn protocol.Connection, folder string, fs *db.FileSet, ignores *ignore.Matcher, prevSequence int64, dropSymlinks bool) {
deviceID := conn.ID()
var err error
@ -1841,7 +1840,7 @@ func sendIndexes(conn protocol.Connection, folder string, fs *db.FileSet, ignore
defer l.Debugf("Exiting sendIndexes for %s to %s at %s: %v", folder, deviceID, conn, err)
// We need to send one index, regardless of whether there is something to send or not
prevSequence, err = sendIndexTo(prevSequence, conn, folder, fs, ignores, dbLocation, dropSymlinks)
prevSequence, err = sendIndexTo(prevSequence, conn, folder, fs, ignores, dropSymlinks)
// Subscribe to LocalIndexUpdated (we have new information to send) and
// DeviceDisconnected (it might be us who disconnected, so we should
@ -1864,7 +1863,7 @@ func sendIndexes(conn protocol.Connection, folder string, fs *db.FileSet, ignore
continue
}
prevSequence, err = sendIndexTo(prevSequence, conn, folder, fs, ignores, dbLocation, dropSymlinks)
prevSequence, err = sendIndexTo(prevSequence, conn, folder, fs, ignores, dropSymlinks)
// Wait a short amount of time before entering the next loop. If there
// are continuous changes happening to the local index, this gives us
@ -1875,7 +1874,7 @@ func sendIndexes(conn protocol.Connection, folder string, fs *db.FileSet, ignore
// sendIndexTo sends file infos with a sequence number higher than prevSequence and
// returns the highest sent sequence number.
func sendIndexTo(prevSequence int64, conn protocol.Connection, folder string, fs *db.FileSet, ignores *ignore.Matcher, dbLocation string, dropSymlinks bool) (int64, error) {
func sendIndexTo(prevSequence int64, conn protocol.Connection, folder string, fs *db.FileSet, ignores *ignore.Matcher, dropSymlinks bool) (int64, error) {
deviceID := conn.ID()
initial := prevSequence == 0
batch := newFileInfoBatch(nil)