This is in preparation for the upcoming 'clean' and 'repair' commands.
It also helps to keep the API stable.
Depends on D11452
bruns |
Baloo | |
Frameworks |
This is in preparation for the upcoming 'clean' and 'repair' commands.
It also helps to keep the API stable.
Depends on D11452
$ baloodb devices --missing-only --mounted-only Listing database contents... + device:2053 indexed-items:115 fstype:ext4 fsname:/dev/sda5 mount:/home + device:2049 indexed-items:19 fstype:ext4 fsname:/dev/sda1 mount:/ + device:22 indexed-items:2 fstype:tmpfs fsname:tmpfs mount:/run Found 3 matching in 3 devices Elapsed: 3.447 secs
No Linters Available |
No Unit Test Coverage |
src/engine/databasesanitizer.h | ||
---|---|---|
41 ↗ | (On Diff #30716) | Is this correct? IgnoreMounted = (1 << 1) = 2 == IgnoreUnavailable? |
src/engine/databasesanitizer.h | ||
---|---|---|
41 ↗ | (On Diff #30716) | That's a sneaky question! :-) |
src/engine/databasesanitizer.cpp | ||
---|---|---|
100 ↗ | (On Diff #31365) | As you are not iterating over sorted keys, just directly iterate on the map. |
104 ↗ | (On Diff #31365) | Why are you fetching the url a second time here? url == map[key].second. |
225 ↗ | (On Diff #31365) | You filter a second time here (first time in createList). I would propose to use the same format independent of the Ignore(Un)Available. |
237 ↗ | (On Diff #31365) | This needs improvement - if you only print the inaccessible ones, the count is off. |
src/engine/databasesanitizer.h | ||
41 ↗ | (On Diff #30716) | Hm still awkward: IgnoreNone = 0, IgnoreAvailable = 1, IgnoreUnavailable = 2, IgnoreMounted = IgnoreAvailable << 4, <-- (1 << 4) == 16 IgnoreUnmounted = IgnoreUnavailable << 4 <-- (2 << 4) == 32 |
src/engine/databasesanitizer.cpp | ||
---|---|---|
116 ↗ | (On Diff #31811) | I think this becomes a little bit clearer if you move it to the top of the map iteration and use a continue; to process the next item, e.g.: quint64 id= it.key(); deviceId = idToDeviceId(id); // idutils.h if (!includeIds.isEmpty() && !includeIds.contains(deviceId)) { continue; } else if (excludeIds.contains(info.deviceId)) { continue; } else if (urlFilter && !urlFilter->match(it.value()).hasMatch()) continue; } checkedFiles += 1; FileInfo info; .... if (info.accessible) accessibleCount++ if ((info.accessible && !(accessFilter & IgnoreAvailable)) || (!info.accessible && !(accessFilter & IgnoreUnavailable))) { result.append(info); } ignoredCount = map.size() - checkedFiles |
134 ↗ | (On Diff #31811) | for the second, return struct summary { quint64 ignored; quint64 accessible; quint64 inaccessible; }; |
183 ↗ | (On Diff #31811) | You can omit DatabaseSanitizer:: here |
src/engine/databasesanitizer.h | ||
41 ↗ | (On Diff #30716) | Thats probably not what you want - IgnoreUnmounted (mounted-only) implicitly includes IgnoreUnavailable, so you will exclude listing unavailable files even on mounted filesystems. |
src/engine/experimental/databasesanitizer.cpp | ||
---|---|---|
33 | double QDebug |
src/engine/experimental/databasesanitizer.cpp | ||
---|---|---|
193 ↗ | (On Diff #32014) | this is definitely wrong, erasing invalidates iterators. it = usedDevices.erase(it); |
195 ↗ | (On Diff #32014) | you can move the block with the iteration over usedDevices and filtering into printDevices ... You filter for IgnoreMounted there anyway. |
271 ↗ | (On Diff #32014) | Filtering again? |
Save the missing comment for "tmpfs", looks fine, thanks!
src/engine/experimental/databasesanitizer.cpp | ||
---|---|---|
270–271 ↗ | (On Diff #32014) | This line definitely needs a comment why this is here |