Jakob Borg
ff88430efb
feat: add debug commands for folder counts and files (#10206)
This adds two debugging commands that print information directly from
the database; one for folder counts, and one for file metadata for files
matching a pattern in a folder. E.g.,
```
% syncthing debug database-counts p3jms-73gps
DEVICE TYPE FLAGS DELETED COUNT SIZE
-local- FILE ------- --- 0 0
-local- FILE --G---- --- 2473 70094796496
-local- DIRECTORY ------- --- 0 0
-local- DIRECTORY --G---- --- 19 2432
PSEUDOP FILE ------- --- 2473 70094796496
PSEUDOP FILE -nG---- --- 0 0
PSEUDOP DIRECTORY ------- --- 19 2432
PSEUDOP DIRECTORY -nG---- --- 0 0
```
```
% syncthing debug database-file p3jms-73gps 20240929-DSCF1387
DSCF1387
DEVICE TYPE NAME SEQUENCE DELETED MODIFIED SIZE FLAGS VERSION BLOCKLIST
-local- FILE Austin/20240929-DSCF1387.raf 1204 --- 2024-09-29T01:10:54Z 48911888 --G---- HX2ELNU:1744213700 fsQdMvUL
PSEUDOP FILE Austin/20240929-DSCF1387.raf 22279 --- 2024-09-29T01:10:54Z 48911888 ------- HX2ELNU:1744213700 fsQdMvUL
-local- FILE Austin/20240929-DSCF1387.xmp 1196 --- 2024-10-16T08:08:35.137501751Z 5579 --G---- HX2ELNU:1744213700 xDGMnepi
PSEUDOP FILE Austin/20240929-DSCF1387.xmp 19910 --- 2024-10-16T08:08:35.137501751Z 5579 ------- HX2ELNU:1744213700 xDGMnepi
```
The local flag bits get a string representation for the bitmask,
```
FlagLocalUnsupported: "u",
FlagLocalIgnored: "i",
FlagLocalMustRescan: "r",
FlagLocalReceiveOnly: "e",
FlagLocalGlobal: "G",
FlagLocalNeeded: "n",
FlagLocalRemoteInvalid: "v",
```
2025-07-04 15:46:24 +02:00
..
2025-06-09 05:48:01 +00:00
2022-05-22 22:10:18 +02:00
2024-02-27 13:05:19 +01:00
2025-06-25 18:18:12 +00:00
2025-05-26 14:22:30 +02:00
2025-06-29 10:18:51 +02:00
2025-06-20 04:24:45 +00:00
2025-04-08 12:45:05 +00:00
2025-05-26 13:37:26 +02:00
2024-11-19 11:32:56 +01:00
2025-06-09 07:20:46 +02:00
2024-05-18 20:31:49 +03:00
2023-02-22 12:22:52 +01:00
2024-09-28 17:16:44 +02:00
2025-04-12 15:16:36 +02:00
2024-02-10 21:02:42 +01:00
2025-06-29 10:18:51 +02:00
2025-06-20 04:24:45 +00:00
2025-07-02 20:40:38 +02:00
2025-06-25 18:18:12 +00:00
2025-07-02 20:40:38 +02:00
2025-07-04 15:46:24 +02:00
2022-07-28 17:32:45 +02:00
2024-11-19 11:32:56 +01:00
2025-05-26 14:22:30 +02:00
2025-06-13 07:33:31 +02:00
2023-08-21 19:44:33 +02:00
2024-08-10 12:58:20 +01:00
2024-12-01 16:50:17 +01:00
2025-03-29 13:50:08 +01:00
2023-08-21 19:44:33 +02:00
2023-08-21 19:44:33 +02:00
2025-03-30 11:56:29 -07:00
2023-08-21 19:44:33 +02:00
2023-12-11 22:06:45 +01:00
2025-06-09 05:48:01 +00:00
2023-08-21 19:44:33 +02:00
2025-06-09 05:48:01 +00:00
2024-11-19 11:32:56 +01:00
2025-06-25 18:18:12 +00:00
2025-06-29 10:18:51 +02:00
2025-05-26 21:40:54 +02:00
2025-06-14 00:16:22 +02:00