Prechádzať zdrojové kódy

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 <[email protected]>
Co-authored-by: Jakob Borg <[email protected]>
Tommy van der Vorst 7 mesiacov pred
rodič
commit
3c955a9706
1 zmenil súbory, kde vykonal 18 pridanie a 0 odobranie
  1. 18 0
      lib/syncthing/internals.go

+ 18 - 0
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)
+}