MCPcopy
hub / github.com/syncthing/syncthing / DebugCounts

Method DebugCounts

internal/db/sqlite/folderdb_local.go:139–165  ·  view source on GitHub ↗
(out io.Writer)

Source from the content-addressed store, hash-verified

137}
138
139func (s *folderDB) DebugCounts(out io.Writer) error {
140 type deviceCountsRow struct {
141 countsRow
142
143 DeviceID string
144 }
145
146 delMap := map[bool]string{
147 true: "del",
148 false: "---",
149 }
150
151 var res []deviceCountsRow
152 if err := s.stmt(`
153 SELECT d.device_id as deviceid, s.type, s.count, s.size, s.local_flags, s.deleted FROM counts s
154 INNER JOIN devices d ON d.idx = s.device_idx
155 `).Select(&res); err != nil {
156 return wrap(err)
157 }
158
159 tw := tabwriter.NewWriter(out, 2, 2, 2, ' ', 0)
160 fmt.Fprintf(tw, "%s\t%s\t%s\t%s\t%s\t%s\n", "DEVICE", "TYPE", "FLAGS", "DELETED", "COUNT", "SIZE")
161 for _, row := range res {
162 fmt.Fprintf(tw, "%s\t%s\t%s\t%s\t%d\t%d\n", shortDevice(row.DeviceID), shortType(row.Type), row.LocalFlags.HumanString(), delMap[row.Deleted], row.Count, row.Size)
163 }
164 return tw.Flush()
165}
166
167func (s *folderDB) DebugFilePattern(out io.Writer, name string) error {
168 type hashFileMetadata struct {

Callers

nothing calls this directly

Calls 7

shortDeviceFunction · 0.85
shortTypeFunction · 0.85
stmtMethod · 0.80
wrapFunction · 0.70
SelectMethod · 0.65
HumanStringMethod · 0.45
FlushMethod · 0.45

Tested by

no test coverage detected