From 04fdafa280a3af6d0698b808a5294b315f21f135 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Fri, 8 Feb 2019 16:42:58 +0100 Subject: [PATCH] lib/db, lib/model: Remove dead code (#5517) --- lib/db/lowlevel.go | 5 ----- lib/model/model.go | 11 +++++------ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/lib/db/lowlevel.go b/lib/db/lowlevel.go index 23976dac7..c114557af 100644 --- a/lib/db/lowlevel.go +++ b/lib/db/lowlevel.go @@ -82,11 +82,6 @@ func OpenMemory() *Lowlevel { return NewLowlevel(db, "") } -// 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() diff --git a/lib/model/model.go b/lib/model/model.go index 8c441ef04..d838ce9d3 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -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)