MCPcopy
hub / github.com/syncthing/syncthing / ListDevicesForFolder

Method ListDevicesForFolder

internal/db/sqlite/folderdb_local.go:117–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

115}
116
117func (s *folderDB) ListDevicesForFolder() ([]protocol.DeviceID, error) {
118 var res []string
119 err := s.stmt(`
120 SELECT DISTINCT d.device_id FROM counts s
121 INNER JOIN devices d ON d.idx = s.device_idx
122 WHERE s.count > 0 AND s.device_idx != {{.LocalDeviceIdx}}
123 ORDER BY d.device_id
124 `).Select(&res)
125 if err != nil {
126 return nil, wrap(err)
127 }
128
129 devs := make([]protocol.DeviceID, len(res))
130 for i, s := range res {
131 devs[i], err = protocol.DeviceIDFromString(s)
132 if err != nil {
133 return nil, wrap(err)
134 }
135 }
136 return devs, nil
137}
138
139func (s *folderDB) DebugCounts(out io.Writer) error {
140 type deviceCountsRow struct {

Callers

nothing calls this directly

Calls 4

DeviceIDFromStringFunction · 0.92
stmtMethod · 0.80
wrapFunction · 0.70
SelectMethod · 0.65

Tested by

no test coverage detected