Commit ad4620b
committed
fix(core): remove the added cameras' staging files with the last profile
A write of the added cameras' store, or of its commit journal, first
puts the new bytes in a staging file beside the target and then renames
it over the target. If the process crashes, or the write or sync fails,
before the rename, the staging file stays behind. On a host without a
TPM it holds plaintext embeddings. Deleting the last profile removed
the store and the journal but not these files.
- storage::delete also removes the staging files that the store's and
the journal's writers leave (.<user>.json.tmp-<pid>,
.<user>.json.commit-tmp-<pid>, .<user>.json.intent.commit-tmp-<pid>).
It removes them after the journal and the store and before the
enrollment, syncing the directory after each removal, so a failure
still leaves the request repeatable. Deleted.camera_store counts them.
- The writers take these names from multi_camera::staging_path, and the
sweep matches them with is_staging_file_of. A match needs the
account's exact file name followed by one staging tag and a decimal
pid, so another account's files never match.
Tests: deleting_an_account_removes_the_staging_files_its_camera_store_writers_left,
which fails without the sweep, and
staging_files_of_the_store_and_its_journal_match_and_other_names_do_not.
Signed-off-by: Wisbendji Fimerlus <archledger236@gmail.com>1 parent d2fd1aa commit ad4620b
3 files changed
Lines changed: 180 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
119 | 168 | | |
120 | 169 | | |
121 | 170 | | |
| |||
835 | 884 | | |
836 | 885 | | |
837 | 886 | | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
842 | | - | |
843 | | - | |
844 | | - | |
| 887 | + | |
845 | 888 | | |
846 | 889 | | |
847 | 890 | | |
| |||
1230 | 1273 | | |
1231 | 1274 | | |
1232 | 1275 | | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
1233 | 1316 | | |
1234 | 1317 | | |
1235 | 1318 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 121 | + | |
128 | 122 | | |
129 | 123 | | |
130 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
939 | 939 | | |
940 | 940 | | |
941 | 941 | | |
942 | | - | |
943 | | - | |
| 942 | + | |
| 943 | + | |
944 | 944 | | |
945 | 945 | | |
946 | 946 | | |
947 | 947 | | |
948 | | - | |
| 948 | + | |
| 949 | + | |
949 | 950 | | |
950 | 951 | | |
951 | 952 | | |
| |||
975 | 976 | | |
976 | 977 | | |
977 | 978 | | |
978 | | - | |
| 979 | + | |
| 980 | + | |
979 | 981 | | |
980 | | - | |
981 | | - | |
| 982 | + | |
| 983 | + | |
982 | 984 | | |
983 | 985 | | |
984 | | - | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
985 | 992 | | |
986 | | - | |
| 993 | + | |
987 | 994 | | |
988 | 995 | | |
989 | 996 | | |
| |||
994 | 1001 | | |
995 | 1002 | | |
996 | 1003 | | |
997 | | - | |
998 | 1004 | | |
999 | 1005 | | |
1000 | 1006 | | |
1001 | 1007 | | |
1002 | 1008 | | |
1003 | 1009 | | |
1004 | 1010 | | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
1005 | 1035 | | |
1006 | 1036 | | |
1007 | 1037 | | |
| |||
1211 | 1241 | | |
1212 | 1242 | | |
1213 | 1243 | | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
1214 | 1294 | | |
1215 | 1295 | | |
1216 | 1296 | | |
| |||
0 commit comments