-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Be more selective about file metdata in listdir (#14434)
The directory iterator we use is configurable about what file metdata to retrieve. This can in some situations significantly improve performance of generating directory listing.
- Loading branch information
Showing
3 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import enum | ||
import pytest | ||
|
||
from middlewared.test.integration.utils import call | ||
|
||
|
||
class DirectoryRequestMask(enum.IntFlag): | ||
ACL = enum.auto() | ||
CTLDIR = enum.auto() | ||
REALPATH = enum.auto() | ||
XATTRS = enum.auto() | ||
ZFS_ATTRS = enum.auto() | ||
|
||
|
||
@pytest.mark.parametrize('select_key,request_mask', [ | ||
('realpath', DirectoryRequestMask.REALPATH.value), | ||
('acl', DirectoryRequestMask.ACL.value), | ||
('zfs_attrs', DirectoryRequestMask.ZFS_ATTRS.value), | ||
('is_ctldir', DirectoryRequestMask.CTLDIR.value), | ||
('xattrs', DirectoryRequestMask.XATTRS.value), | ||
(['xattrs', 'user_xattrs'], DirectoryRequestMask.XATTRS.value), | ||
([], None), | ||
('name', 0) | ||
]) | ||
def test__select_to_request_mask(select_key, request_mask): | ||
if select_key == []: | ||
val = call('filesystem.listdir_request_mask', []) | ||
assert val is None | ||
else: | ||
val = call('filesystem.listdir_request_mask', [select_key]) | ||
assert val == request_mask |