From 3c955a9706000b01c24265fc35fbceae9ee10e09 Mon Sep 17 00:00:00 2001 From: Tommy van der Vorst Date: Fri, 28 Mar 2025 14:44:01 +0100 Subject: [PATCH] chore(lib): expose model methods to obtain progress (#9886) ### Purpose This exposes four methods from `Model` through `Internals`. It allows apps like Synctrain to obtain information about local/remote need and sync progress. ### Testing No testing seems necessary, functions are exported verbatim. ### Screenshots N/a ### Documentation Not public API, I am aware this interface may change at any time. ## Authorship OK. Co-authored-by: Ross Smith II Co-authored-by: Jakob Borg --- lib/syncthing/internals.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/syncthing/internals.go b/lib/syncthing/internals.go index 3fd484733..704cfba2a 100644 --- a/lib/syncthing/internals.go +++ b/lib/syncthing/internals.go @@ -84,3 +84,21 @@ func (m *Internals) DBSnapshot(folderID string) (*db.Snapshot, error) { func (m *Internals) ScanFolderSubdirs(folderID string, paths []string) error { return m.model.ScanFolderSubdirs(folderID, paths) } + +func (m *Internals) FolderProgressBytesCompleted(folder string) int64 { + return m.model.FolderProgressBytesCompleted(folder) +} + +// NeedFolderFiles returns paginated list of currently needed files in +// progress, queued, and to be queued on next puller iteration. +func (m *Internals) NeedFolderFiles(folder string, page, perpage int) ([]protocol.FileInfo, []protocol.FileInfo, []protocol.FileInfo, error) { + return m.model.NeedFolderFiles(folder, page, perpage) +} + +func (m *Internals) RemoteNeedFolderFiles(folder string, device protocol.DeviceID, page, perpage int) ([]protocol.FileInfo, error) { + return m.model.RemoteNeedFolderFiles(folder, device, page, perpage) +} + +func (m *Internals) LocalChangedFolderFiles(folder string, page, perpage int) ([]protocol.FileInfo, error) { + return m.model.LocalChangedFolderFiles(folder, page, perpage) +}